IF (expression) ... ELSE ... ENDIF


Execute one of several alternative blocks of statements.

Syntax

IF <lCondition>

   <statements>...

[ELSE]

   <statements>...

ENDIF

Arguments

<lCondition> is a logical expression. If it evaluates to TRUE all following statements are executed until an ELSE or ENDIF is encountered.

ELSE identifies statements to execute if the IF condition evaluates to FALSE.

Description

The IF control structure works by branching execution to statements following the first TRUE evaluation of the IF condition. Execution then continues until the next ELSE, or ENDIF is encountered whereupon execution branches to the first statement following the ENDIF.

If no condition evaluates to TRUE, control passes to the first statement following the ELSE statement. If an ELSE statement is not specified, control branches to the first statement following the ENDIF statement.

IF...ENDIF structures may be nested within other IF...ENDIF structures.

Examples

nNumber := 1

IF nNumber > 1

   * statements not executed here

ELSE

   * statements executed here

ENDIF

* execution then continues from here



CAPITAL VISUAL BUILDER