Operators of higher precedence are executed before operators with lower precedence:
A+B*C is evaluated as A+(B*C) (multiplication has a higher precedence than addition)
Operators of equal precedence are executed in the order they appear in the expression from left to right:
The following operators are available in the ST editor:
Operator |
Description | Precedence |
---|---|---|
( ) |
Parentheses, function call |
high low |
- NOT |
Negation Complement |
|
** * / MOD |
Raise to a power Multiplication Division Modulo (remainder) |
|
+ - |
Addition Subtraction |
|
>,<,>=,<= |
Comparison |
|
= <> |
Equal Not equal |
|
&, AND |
Boolean AND |
|
XOR |
Boolean exclusive OR |
|
OR |
Boolean OR |
Operators link operands. The combination of operators and operands is called expression.