Control Structures

if

Supported By

Syntax

if condition then statement [else statement]

if condition
then statement [else statement]

if condition
then statement
[else statement]

if condition then
   statementList
else statement

if condition then
   statementList
[else
   statementList]

end if

Condition yields true or false.

Description

The if structure tests for the specified condition and, if the condition is true, executes the statement or series of statements that follow. If the condition is false and an else keyword is specified, the if structure executes the statement or series of statements that follow the else keyword instead.