IF...END IF
(Statement)

Conditionally execute specified statement blocks depending upon the evaluation of a conditional expression.

IF <conditional expression> THEN
:
[ELSEIF <conditional expression> THEN]
:
[ELSE]
:
END IF

This statement controls the execution of statement blocks depending upon the evaluation of <conditional expression>.
If <conditional expression> of the IF statement is true (not 0), the statement block following IF and preceding ELSEIF is executed; if false (0), <conditional expression> of the ELSEIF statement is evaluated. In this manner, subsequent statement blocks are also evaluated and executed depending upon the result.

DIM li1 As Integer
|
|
IF li1 = 0 THEN
|
'If li1 is 0
|
STOP
|
'Stop program execution
|
ELSEIF li1 = 1 THEN
|
'If li1 is 1
|
GOTO *samp1
|
'Jump to the label *samp1
|
GO TO *samp2
|
'Jump to the label *samp2
|
ELSEIF li1 = 2 THEN
|
'If li1 is 2
|
GOSUB *samp3
|
'Call the subroutine beginning with the label name *samp3
|
ELSE
|
'If li1 is any other value
|
RETURN
|
'Return to the caller program
|
END IF
|
'Declare the end of the IF statement
|