IF...THEN...ELSE (Statement)


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


IF <conditional expression> THEN {<statement>|<labelname>}
[ELSE {<statement>|<labelname>}]


This statement controls the execution of specified <statement>s depending upon the evaluation of <conditional expression>.
If <conditional expression> is true (not 0), <statement> immediately following THEN is executed. If it is false (0), <statement> immediately following ELSE is executed.



IF i1 = 0 THEN STOP ELSE GOSUB *samp1
'If i1 is 0, stop program execution. If i1 is any other value,
'call the subroutine beginning with the label name *samp1
i1 = i1 + 1
'Add
END
'Declare the end of program
*samp1:
'Define the subroutine label
i0 =0
'Assign 0 to i0
RETURN
'Return to the caller program


Top