Parentheses can be used to specify the order in which individual conditions of complex conditions are to be evaluated when it is necessary to depart from the implied evaluation precedence.
Conditions within parentheses are evaluated first, and, within nested parentheses, evaluation proceeds from the least inclusive condition to the most inclusive condition. When parentheses are not used, or parenthesized conditions are at the same level of inclusiveness, the following hierarchical order of logical evaluation is implied until the final truth value is determined:
- Values are established for arithmetic expressions and functions if and when the conditions containing them are evaluated. Similarly, negated conditions are evaluated if and when it is necessary to evaluate the complex condition that they represent. (See the section Formation and Evaluation Rules.)
- Truth values for simple conditions are established in the following order:
relation (following the expansion of any abbreviated relation condition) class condition-name switch-status sign
- Truth values for negated conditions are established.
- Truth values for combined conditions are established: "AND" logical operators, followed by "OR" logical operators.
- Truth values for negated combined conditions are established.
- When the sequence of evaluation is not completely specified by parentheses, the order of evaluation of consecutive operations of the same hierarchical level is from left to right.