Operator Precedence

The operator precedence is the order in which ClearSCADA performs the various operations when evaluating an expression. ClearSCADA performs the operations in order (highest precedence first, lowest precedence last).

When the operators have equal precedence, ClearSCADA performs them in the order they appear from left to right.

Precedence

Operator

5 (Highest precedence)

NOT, Negation

4

Power

3

Multiply, Divide, Modulus, AND, OR

2

Addition, Subtraction, OR

1 (Lowest precedence)

Comparisons

So, operations with precedence 5 are performed before operations with precedence 4, 3, 2, and 1. Operations with precedence 4 are only performed before operations with precedence 3, 2, and 1 and so on.

Operations within parentheses are performed before their resultant value is used in the expression. For example:

10 * (35 - 5 + 10)

In this expression, the operators in the parentheses are performed first. So, 35-5 is performed first, resulting in 30. Then the 10 is added to make 40. The subtraction is performed before the addition as subtraction and addition have the same precedence, so ClearSCADA performs them in the order they appear from left to right.

When the operators in the parentheses have been performed, the resultant value of 40 is used in the expression.

The multiplication is performed next as it has the next highest precedence. The multiplication results in the value 400.


Disclaimer

ClearSCADA 2017 R2