When multiple operators occur in an expression, the expression is evaluated in a specific order depending upon the operators in the expression.
Parentheses can be used to change the order of expression evaluation. The following table shows the priority of all the operators used in expressions, including signed decimal values.
Priority | Operators |
---|---|
1 | signed (+ and -) decimal values, *NOT, ¬ |
2 | * , / |
3 | +, - (when used between two operands) |
4 | *CAT, ||, *BCAT, |>, *TCAT, |< |
5 | *GT, *LT, *EQ, *GE, *LE, *NE, *NG, *NL, >, <, =, >=, <=, ¬=, ¬>, ¬< |
6 | *AND, & |
7 | *OR, | |
A priority of 1 is the highest priority (signed values are evaluated first); a priority of 7 is the lowest priority (OR relationships are evaluated last). When operators with different priority levels appear in an expression, operations are performed according to priorities.
When operators of the same priority appear in an expression, operations are performed from left to right within the expression. Parentheses can always be used to control the order in which operations are performed. The value of a parenthetical expression is determined from the innermost level to the outermost level, following the priorities stated above within matching sets of parentheses.