Math Operations

The table below lists and describes valid EngageOne™ Enrichment math operators. Math operations are processed before concatenation. EngageOne™ Enrichment evaluates these expressions from left to right according to the indicated operator precedence. If a mathematical expression contains parentheses, EngageOne™ Enrichment evaluates expressions within the parentheses first.

Table 1. EngageOne™ Enrichment Math Operators
Operator Description Precedence
+ Addition 3
- Subtraction 3
* Multiplication 2
% Integer Division—returns the integer result when one value is divided by another
Note: When using integer division of variables in a rule file, at least one space must separate the % math operator from the variables. For example, %%var1%%%var2 is incorrect, but %%var1 %%%var2 (with space after %%var1) is correct.
2
# Remainder—returns only the remainder when one value is divided by another 2
( and ) Open and close parentheses 1

You can nest parentheses as deeply as necessary, as long as every open parenthesis has a complementary closing parenthesis. The table below shows how the results of EngageOne™ Enrichment math expressions can differ based on the evaluation order.

Table 2. Example of Evaluation Order
Expression Result
(2 + 5) * 10 - 4 % 2 68
(2 + 5 * 10) - 4 % 2 50
2 + 5 * 10 - 4 % 2 50
2 + 5 * (10 - 4 % 2) 42
2 + (5 * 10 - 4) % 2 25
(2 + 5) * (10 - 4) % 2 21
2 + (5 * (10 - 4)) % 2 17
(2 + (5 * (10 - 4))) % 2 16