|
|
The precedence ranking of an operator determines the order
in which it is evaluated in an expression. The levels of ranking are:
Table 2-6 Operator Precedence
Precedence |
Operators |
highest | [ ] |
. | NOT, BNOT |
. | <<, >>, BAND, BOR |
. | *, /, MOD, AND |
. | +, -, OR |
lowest | <, <=, =, >, >=, <> |
Operators of highest precedence are evaluated first. For example, since
* ranks above +, the following expressions are evaluated
identically:
(x + y * z) and (x + (y * z))
When operators in a sequence have equal precedence, evaluation
proceeds from left to right. For example, each of the following
expressions are evaluated identically:
(x + y + z) and ((x + y) + z)
|