Chapter 14. Statement Reference
207
____________________________________________________________________
Flow control statement
IF…THEN…ELSE…END IF
Conditionally executes specified statement blocks depending upon the evaluation of a
conditional expression.
____________________________________________________________________
Syntax:
Syntax:Syntax:
Syntax:
Syntax 1:
IF conditionalexpression THEN
statementblock1
[ELSE
statementblock2]
END IF
Syntax 2:
IF conditionalexpression ELSE
statementblock
END IF
Parameter:
Parameter:Parameter:
Parameter:
conditionalexpression
A numeric expression which evaluates to true or false.
Description:
Description:Description:
Description:
IF statement block tests whether conditionalexpression is true or false. If the
condition is true (not zero), statementblock which follows THEN is executed; 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.
Kommentare zu diesen Handbüchern