Stacks API

Come build with us.
Stacks API v6 for Stacks 2.5


  <   Templates Variable Reference


Integer Math

%( 1 + 2 )%

This content is open source. You can edit it and submit a pull request on GitHub.
This page is generated from this file.


© . YourHead Software all rights reserved.

Integer Math

%( 1 + 2 )%

Available: Stacks API v3

Usage

%([!] <argument1> <operator> <argument2> )%

Description

Math operations for evaluating simple integer functions. The syntax is identical to Integer Comparison. Statements can be nested, but must contain only two arguments.

Example 1: add to literal integers

evaluates to 2

%( 1 + 1 )%

Example 2: nested operations

evaluates to 15

%( %( 1 + 2 )% - %( 3 * 4 )% )%

Example 3: logical operations

evaluates to true only if both enables are true

%( %id=enable1% && %id=enable2% )%

Example 4: integer divide by 2

evaluates to 12

%( 25 >> 1 )%

Note: Since this is integer-only math, there is no divide operator. However the shift-right operator can provide a divide-by-two (see last example).

© . YourHead Software all rights reserved.