Document Templates : DGL Statements : Control Flow Statements : IF/THEN/ELSE Statement

IF/THEN/ELSE Statement

Statement Syntax:

IF boolean_expression THEN
statements
[ ELSE statements ]
END IF ;

The IF/THEN/ELSE construct is used for conditional execution of DGL statements.

In this statement, the statements following the THEN (and before any ELSE) are executed if the boolean_expression evaluates to true. If it is evaluated to false, the statements following the ELSE are executed, when present.

Here is an example:

IF a >= b THEN
EXECUTE (’DATE’) ;
INCLUDE (’sample.txt’) ;
ELSE
WRITE (’a is less than b’) ;
END IF ;