IIF()

The IIF() operator returns the second or third parameter according to the boolean expression given as first argument.

Syntax

IIF( bool-expr, true-expr, false-expr)
  1. bool-expr is a boolean expression.
  2. 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 var VARCHAR(10)
  LET var = arg_val(1)
  DISPLAY IIF(var == "A", "Accepted", "Rejected")
END MAIN