Combined Conditions

Two or more conditions can be logically connected to form a combined condition.

Read syntax diagramSkip visual syntax diagram
Combined Conditions - Format

                .----------------------.   
                V                      |   
>>-condition-1----+-AND-+--condition-2-+-----------------------><
                  '-OR--'                  

The condition to be combined may be any of the following:
  • A simple-condition
  • A negated simple-condition
  • A combined condition
  • A negated combined condition (that is, the NOT logical operator followed by a combined condition enclosed in parentheses)
  • Combinations of the preceding conditions, specified according to the rules in the following table.
Table 1. Combined Conditions—Permissible Element Sequences
Combined condition element Leftmost When not leftmost, can be immediately preceded by: Rightmost When not rightmost, can be immediately followed by:
simple-condition Yes

OR
NOT
AND
(

Yes

OR
AND
)

OR
AND

No

simple-condition
)

No

simple-condition
NOT
(

NOT Yes

OR
AND
(

No

simple-condition
(

( Yes

OR
NOT
AND
(

No

simple-condition
NOT
(

) No

simple-condition
)

Yes

OR
AND
)

Parentheses are never needed when either ANDs or ORs (but not both) are used exclusively in one combined condition. However, parentheses may be needed to modify the implicit precedence rules to maintain the correct logical relation of operators and operands.

There must be a one-to-one correspondence between left and right parentheses, with each left parenthesis to the left of its corresponding right parenthesis.

The following table illustrates the relationships between logical operators and conditions C1 and C2.

Table 2. Logical Operators and Evaluation Results of Combined Conditions
Value for C1 Value for C2 C1 AND C2 C1 OR C2 NOT (C1 AND C2) NOT C1 AND C2 NOT (C1 OR C2) NOT C1 OR C2
True True True True False False False True
False True False True True True False True
True False False True True False False False
False False False False True False True True