Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Complex conditions

Function

A complex condition consists of a combination of two or more simple conditions.

Format


condition {AND | OR} [NOT] condition  [{AND | OR} [NOT] condition] ...


Syntax rules

  1. condition specifies a simple condition.

  2. Parentheses may be used within a complex condition to improve readability or to modify the normal hierarchical sequence of execution.

  3. The simple conditions within a complex condition are separated from each other by logical operators, according to the specified rules. The logical operators must be preceded by a space and followed by a space.

  4. A complex condition may comprise up to 60 simple conditions.

  5. Table 22 lists the logical operators and their meanings.

    Operator

    Meaning

    Example

    OR

    Logical inclusive Or
    (either or both)

    The expression A OR B is true if A is true, or B is true, or both A and B are true.

    AND

    Logical conjunction (both)

    The expression A AND B is true only if both A and B are true.

    NOT

    Logical negation

    The expression "NOT" A is true only if A is false.

    Table 22: Logical operators

  6. The ways in which conditions and logical operators may be combined are shown in Table 23.

    First symbol

    Second symbol

    simple-condition

    OR

    AND

    NOT

    (

    )

    simple-condition

    -

    P

    P

    -

    -

    P

    OR

    P

    -

    -

    P

    P

    -

    AND

    P

    -

    -

    P

    P

    -

    NOT

    P

    -

    -

    -

    P

    -

    (

    P

    -

    -

    P

    P

    -

    )

    -

    P

    P

    -

    -

    P

    Table 23: Valid symbol pairs of conditions and logical operators1

    1) P indicates that the two symbols may be used as a pair.

  7. Rules of precedence for evaluation of expressions

    The evaluation of complex conditions starts with the innermost pair of parentheses and proceeds through to the outermost pair of parentheses.

    If the order of evaluation is not determined by parentheses, the expression is evaluated according to the following precedence (hierarchical levels):

    • Arithmetic expressions

    • Relational operators

    • NOT conditions

    • AND and its associated conditions are evaluated from left to right.

    • OR and its associated conditions are evaluated last, also proceeding from left to right.

    • If consecutive expressions have the same hierarchical level, they are evaluated from left to right.

    Example 8-9

    Consider this expression:

    A IS NOT GREATER THAN B OR A + B IS EQUAL TO C AND D IS POSITIVE

    This expression is evaluated as if the following parentheses had been supplied:

    (A IS NOT GREATER THAN B) OR (((A+B) IS EQUAL TO C) AND (D IS POSITIVE)).

    Example 8-10

    Table 24 shows some of the relationships between logical operators and simple conditions.

    Operands

    Value of A 1)

    True

    False

    True

    False

    Value of B 1)

    True

    True

    False

    False

    Combinations

    NOT A

    False

    True

    False

    True

    A AND B

    True

    False

    False

    False

    A OR B

    True

    True

    True

    False

    NOT (A AND B)

    False

    True

    True

    True

    NOT A AND B

    False

    True

    False

    False

    NOT (A OR B)

    False

    False

    False

    True

    NOT A OR B

    True

    True

    False

    True


    Table 24: Results of logical operators

    1) A and B represent simple conditions.