12 Operator precedence


When a mathematical or logical expression is being evaluated, all the operators (+, * , DIV etc) are given a priority of from 1 to 7. Priority 1 operators are those acted upon first, and priority 7 last.

Here is the complete fist:

PriorityOperator
1-Unary minus
+Unary plus
NOT

Logical NOT
FN

Functions
()

Brackets
?!$

Indirection operators
2
^

Raise to the power
3
*

Multiplication
/

Division
DIV

Integer division
MOD

Integer remainder
4+Addition
-Subtraction
5=Equal to
<>Not equal to
<Less than
>Greater than
<=ess than or equal to
>=Greater than or equal to
6
AND

Logical and bitwise
7
OR

Logical and bitwise
EOR

Logical and bitwise Exclusive OR

Operators with the same priority are executed left to fight, as they appear in the expression. For example, 22 MOD 3/7 is evaluated as (22 MOD 3)/7. All priorities may be overridden by using brackets.