Order of Evaluation

A condition is evaluated according to the following hierarchy:

  1. Components contained in parentheses are evaluated first. For those components in parentheses, the most deeply nested are evaluated first, followed by those that are less deeply nested. Evaluation always progresses from the most to the least deeply nested components.
  2. NOT conditions are evaluated next. Thus NOT A OR B is equivalent to (NOT A) OR B.
  3. AND conditions are evaluated next.
  4. OR conditions are evaluated next.
  5. Conditions are evaluated from left to right.

Here are some examples of equivalent conditions:

NOT A AND B OR C AND D     ((NOT A) AND B) OR (C AND D)
NOT A AND B AND C          ((NOT A) AND B) AND C
A AND B OR NOT (C OR D)    (A AND B) OR (NOT (C OR D))
NOT ( NOT A OR B OR C )    NOT ( ((NOT A) OR B) OR C )

Evaluation of a condition halts as soon as its truth value is determined. For example, in the condition A AND B, the condition B would not be evaluated if 'A' were false.