Operator Precedence and Associativity

When an expression contains multiple binary operators, the precedence of the operators determines the order in which individual binary operators are evaluated.

Example: The expression x + y * z is evaluated as x + (y * z) because the * operator has higher precedence than the + operator.

The following table lists the binary operators in descending order of precedence.

Category Operators
Reference (dot) .
Exponentiation ^
Unary Negation -
Division /
Multiplication *
Additive +,-
Concatenation (string) &
Relational =,<>,<,>,<=,>=
Unary Logical NOT Not
Logical AND, OR And, Or

When an expression contains two operators with the same precedence, the associativity of the operators determines the order in which the operations are performed. All binary operators are left-associative (the operations are performed from left to right). Precedence and associativity can be controlled using parentheses.