11-18
IF-THEN-ELSE (Statement)[Conforms to SLIM]
Function
Executes a conditional decision of a logical expression.
Format
IF <Conditional expression> THEN {<Statement>|<Label name>} [ELSE
{<Statement>|<Label name>}]
Explanation
This statement controls the execution of a program depending on the condition
of <Conditional expression>.
If <Conditional expression> is true (except for 0), then the latter section of
THEN is executed. If the <Conditional expression> is false (0), then the latter
section of ELSE is executed.
Related Terms
IF-END IF
Example
IF l0 = 0 THEN STOP ELSE GOSUB *samp1
'If i1 is 0, control stops program execution. If il is
'another value, control calls the subroutine with a
'label name of *sampl.
il = il + 1 'il is added.
END 'Defines the program end.
*sampl: 'Defines the subroutine label.
i0 =0 'Substitute 0 for i0.
RETURN 'Returns to the calling program.
Comments to this Manuals