III.10.1 General IFxx Construction
Simple IFxx ... ENDIF constructions can be used to assemble a number of
enclosed statements only, if a particluar condition is met:
IFxx <condition>
<statement 1>
<statement 2>
. ;assembled if <condition> is TRUE
.
<statement n>
ENDIF
The statements 1 through n are assembled if <condition> is TRUE, otherwise
they are ignored.
If it should be possible to select two variants of code depending on a
particular condition, this can be done with an IFxx .. ELSE .. ENDIF
construction. If the <condition> in the IFxx statement is TRUE, then
statements 1 to n are assembled and the statements n+1 to n+m are ignored.
IFxx <condition>
<statement 1>
. ;assembled if <condition> is TRUE
<statement n>
ELSE
<statement n+1>
. ;assembled if <condition> is FALSE
<statement n+m>
ENDIF
Should <condition> be FALSE, it is exactly vice versa! That means the
statements 1 to n are ignored and the statements n+1 to n+m are assembled.
This works also, if the IFxx or ELSE branches contain no statements at all.
Whenever more than two cases have to be distinguished, a corresponding number
of ELSEIFxx branches can be inserted between the IFxx and the ELSE branch.
In such an IFxx .. ELSEIFxx .. ELSE .. ENDIF construction, only the statements
in the branch with the first TRUE condition are assembled. The statements in
all other branches are ignored.
If none of the conditions is TRUE, only the statements in the ELSE branch
(if any) are assembled.
IFxx <condition 1>
. ;assembled if <condition 1> is TRUE
.
ELSEIFxx <condition 2>
. ;assembled if <condition 1> is FALSE,
. ;and <condition 2> is TRUE
ELSEIFxx <condition 3>
. ;assembled if <condition 1> and
. ;<condition 2> are FALSE, and
. ;<condition 3> is TRUE
.
.
ELSEIFxx <condition n>
. ;assembled if <condition 1> thru
. ;<condition n-1> are FALSE and
. ;<condition n> is TRUE
ELSE
. ;assembled if <condition 1> thru
. ;<condition n> are FALSE
ENDIF
IFxx ... ELSEIFxx ... ELSE ... ENDIF constructions may be nested to any depth!
The listing mode of those constructions can be set with the $COND, $NOCOND and
$CONDONLY controls.
|