How to: |
A conditional expression assigns a value based on the result of a logical expression. The assigned value can be numeric or character.
The syntax of a conditional expression is
IF boolean THEN {expression1} [ELSE {expression2}]
where:
Is a Boolean expression. Boolean expressions are described in Boolean Expressions.
Is a numeric, character, date, or conditional expression.
When the Boolean expression is true, the conditional expression returns the THEN expression. Otherwise, it returns the ELSE expression if one is provided.
The THEN and ELSE expressions can themselves be conditional expressions. If the expression following THEN is conditional, it must be enclosed in parentheses. A conditional expression can have up to 16 IF statements.
The variable to which you assign the conditional expression must have a format compatible with the formats of the THEN and ELSE expressions.