IIF()
The IIF()
operator
returns the second or third parameter depending on the boolean expression
given as first argument.
Syntax
IIF( bool-expr, true-expr, false-expr )
- bool-expr is a boolean expression.
- true-expr and false-expr are language expressions.
Usage
The IIF()
operator evaluates the first argument, the
returns the second argument if the first argument is true, otherwise it
returns the third argument.
This allows you to write the equivalent of the following IF
statement,
in a simple scalar expression:
IF bool-expr THEN
RETURN true-expr
ELSE
RETURN false-expr
END IF
Example
MAIN
DEFINE x VARCHAR(10)
LET x = arg_val(1)
DISPLAY IIF(x == "A", "Accepted", "Rejected")
END MAIN