Specifications

Chapter 14. Statement Reference
226
Syntax:
Syntax 1:
IF conditionalexpression THEN
statementblock1
[ELSE
statementblock2]
END IF
Syntax 2:
IF conditionalexpression ELSE
statementblock
END IF
Parameter:
conditionalexpression
A numeric expression which evaluates to true or false.
Description:
IF statement block tests whether conditionalexpression is true or false. If
the condition is true (not zero), statementblock which follows THEN is exe-
cuted; if it is false (zero), statementblock which follows ELSE is executed.
Then, program control passes to the first statement after
END IF.
You can omit either
THEN block or ELSE block.
IF statement block should terminate with END IF which indicates the end of the
block.
IF statement blocks can be nested. When using the IF statement block together
with other block-structured statements (
DEF FN...END DEF, FOR...NEXT, FUNC-
TION...END
FUNCTION, IF...THEN...ELSE...END IF, SELECT...CASEEND
SELECT
, SUB...END SUB, and WHILE...WEND), you can nest them to a maxi-
mum of 30 levels.
Flow control statement
IF...THEN...ELSE...END IF
Conditionally executes specified statement blocks depending upon the evaluation of a condi-
tional expression.