Logical Expressions

Logical expressions result in a value of TRUE or FALSE. These are represented as integers where 0 is FALSE and anything else (usually 1) is TRUE. Logical expressions are normally used within IF THEN ELSE instructions. They include:

  • Expressions combined with the comparison operators. For a complete list of operators, see Operators. For example:
    IF %%x = %%y THEN
    IF %%x = %%y + %%z THEN
  • Expressions combined with the Boolean operators. For a complete list of operators, see Operators. The AND and OR connectors combine two expressions, while the NOT connector negates the single expression following it. For example:
    IF %%w = %%x AND %%y > %%z THEN

    (The condition is TRUE if both %%w = %%x and %%y > %%z.)

  • A logical function. For example:
    IF CHANGED(%%y) THEN

IF THEN ELSE instructions can include other IF THEN ELSE instructions. These instructions can be nested as deeply as is necessary.