How are expressions evaluated?
The operations in an expression are performed in a prescribed order. Operations of equal order are performed from left to right. High precedence operators are evaluated before low precedence operators. The following lists the order in which the operations are performed, from highest to lowest.
- Parenthetical expressions and functions
- Unary Negation, Logical Not, Bitwise Complement Operator
- Multiplication, Division, Modulus
- Addition, Subtraction
- Bitwise Shift Left, Bitwise Shift Right
- Greater Than, Less Than, Greater Than or Equal To, Less Than or Equal To
- Equal To, Not Equal To
- Bitwise And
- Bitwise Exclusive Or
- Bitwise Or
- Logical And
- Logical Or
- Conditional operator ?:
- Comma (separating function arguments)IMPORTANT:
- The HMI device updates data from controllers at a fixed rate of 100, 250, or 500 milliseconds. This update is asynchronous to any scan in a controller.
TIP:
If an expression contains multiple operators or functions, group the conditions in parenthesis "( )". This ensures the correct order of execution and makes it easier to read the expression.
Provide Feedback