Priority of operators

Expressions composed of multiple operators as well as expressions' arguments which contain operators are executed in the order according to the following priority levels:

- indexing , the highest priority, executed first
- access to class members @
- raise to the power ^
- unary arithmetic operators: + -
- arithmetic operators: * / % and bitwise AND: &
- binary arithmetic operators: + - and bitwise OR: |
- an argument of any type, except boolean value
- comparison operators: = < > <= >= <>
- logical conjunction && and negation !
- logical disjunction ||
- an argument with the boolean value
- assignment :=, arithmetic operators +=, -=, *=, /= and bitwise operators |=, &= the lowest priority, executed last

Operators with equal priorities are executed in the order as they appear in code. The order of execution can be changed with use of parentheses. Use expression highlighting to see how the compiler is interpreting hierarchy of your code.

Example:

print 2 * 3 + 1
print 2 * (3 + 1)

"a := {1 2 9}
print :a,1 + 2
print :a,(1 + 2)

Output:

7
8
3
9

See also:

Table of Content