ESL evaluates boolean expressions according to an established precedence of operators. The following lists the order of precedence, from highest to lowest.
1. not
2. and
3. or
Boolean operators have a lower precedence than arithmetic or relational operators. When you combine boolean, arithmetic, and relational operators in a single expression, ESL applies the arithmetic operators, then the relational operators, and finally the boolean operators. For example, consider the expression:
(A > (B - 5) and B < C or D * 2 = E)
Suppose that:
A = 15 B = 20 C = 25 D = 30 E = 30
Thus the expression becomes:
15 > (20 - 5) and 20 < 25 or 30 * 2 = 30
ESL first performs the arithmetic:
15 > 15 and 20 < 25 or 60 = 30
Next, ESL performs the comparisons specified by the relational operators:
false and true or false
ESL then performs the boolean operations. Because the and operator has higher precedence than the or operator, ESL first evaluates the and expression, getting the result false:
false or false
Because one of the operators is false, the result of this entire expression is false.
ESL then performs the or operation:
false
Because neither operand is true, the result is false.