Summary -

In this topic, we described about the Combined Condition with detailed example.

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

Syntax -

Combined Condition Syntax

The condition to be combined can be any of the following ones -

  • A simple-condition
  • A negated simple-condition
  • A combined condition
  • A negated combined condition
  • A combination of the preceding conditions

Parentheses are never needed when either ANDs or ORs (but not both) are used in one combined condition. However, parentheses used to modify the 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. That is, one left parenthesis has its corresponding right parentheses. The below table describes the relationships between logical operators for the conditions C1 and C2 -

Value for C1Value for C2C1 AND C2C1 OR C2NOT (C1 AND C2)NOT (C1 OR C2)
True TrueTrue TrueFalse False
False TrueFalse TrueTrue False
True FalseFalse TrueTrue False
False FalseFalse FalseTrue True