Precedence and association of operators
The rules for precedence and association of operators determine the grouping of operators with operands, and indicate the order in which the operators in an expression are executed.
For complex expressions, use parentheses to avoid ambiguity.
The following table describes the operators.
| Operator | Description | Associativity | Precedence |
|---|---|---|---|
| - | Negative sign | Non-associative | 1 (highest) |
| * | Multiplication | Left | 2 |
| / | Division | Left | 2 |
| OR | Logical OR | Left | 3 |
| AND | Logical AND | Left | 4 |
| NOT | Logical NOT | Left | 5 |
| = | Equal to | Left | 6 |
| <> | Not equal to | Left | 6 |
| < | Less than | Left | 6 |
| > | Greater than | Left | 6 |
| <= | Less than or equal to | Left | 6 |
| >= | Greater than or equal to | Left | 6 |
| + | Addition | Left | 7 |
| - | Subtraction | Left | 7 (lowest) |