Expressions are evaluated left-to-right and from the inside out (in nested functions). Parentheses may be used to alter the default evaluation order of precedence for all operators.
Standard arithmetic operators are supported for use in expressions, listed here in their evaluation precedence.
Note: | * , /, %, and DIV all have the same precedence and are left associative. + and - have the same precedence and are left associative. |
Division by zero defaults to generating a zero result (0), rather than reporting a "divide by zero" error. This avoids invalid or unexpected data aborting a long job. The default behaviour can be changed using
#OPTION ('divideByZero', 'zero'); //evaluate to zero
The divideByZero option can have the following values:
'zero' | Evaluate to 0 - the default behaviour. |
'fail' | Stop and report a division by zero error. |
'nan' | This is only currently supported for real numbers. Division by zero creates a quiet NaN, which will propagate through any real expressions it is used in. You can use NOT ISVALID(x) to test if the value is a NaN. Integer and decimal division by zero continue to return 0. |
The following comparison operators are supported:
The Greater Than or Equal operator must have the Greater Than (>) sign first. For the expression a <=> b, the Equivalence Comparison operator returns -1 if a<b, 0 if a=b, and 1 if a>b. When STRINGs are compared, trailing spaces are generally ignored. Standard library functions, such as Std.Str.Find(), may consider trailing spaces. See the Standard Library Reference for specific details.