Operators specify the type of calculation that you want to perform on the elements of a calculation. InRule includes three different types of calculation operators: arithmetic, comparison, and text.
Type of operators
InRule supports the following arithmetic operators to perform basic mathematical operations such as addition, subtraction, or multiplication:
\ (integer division)
You can compare two values with the following operators. When two values are compared by using these operators, the result is a logical value either TRUE or FALSE.
> (greater than)
< (less than)
>= (greater than or equal to)
<= (less than or equal to)
<> (not equal to)
NOTE: Please review the Value Comparison topic for additional detail about value comparison in InRule.
You can combine logical conditions into larger conditions by using logical operators.
a And b
a Or b
a Xor b
Not(a or b)
Text concatenation operator
Use the ampersand (&) to join, or concatenate, one or more text strings to produce a single piece of text.
Order of operation
If you combine several operators in a single calculation, InRule performs the operations in the order shown in the following list. As a default, InRule evaluates the operators from left to right.
* and / (Multiplication and division)
+ and – (Addition and subtraction)
= < > <= >= <> (Comparison)
Use of parentheses
To change the order of evaluation, enclose in parentheses the part of the calculation to be calculated first.
For example, the following formula produces 11 because InRule calculates multiplication before addition. The calculation multiplies 2 by 3 and then adds 5 to the result.
In contrast, if you use parentheses to change the syntax, InRule adds 5 and 2 together and then multiplies the result by 3 to produce 21.
Please sign in to leave a comment.