Description
The ELSE
instruction always comes after an IF...THEN
instruction. The ELSIF
instruction determines that
an instruction or group of instructions is only executed if the associated
Boolean expression for the IF
instruction has the
value 0 (false) and the associated Boolean expression of the ELSIF
instruction has the value 1 (true). If the condition
of the IF
instruction is 1 (true) or the condition
of the ELSIF
instruction is 0 (false), the command
or group of commands will not be executed.
The THEN
instruction identifies the end of the ELSIF
condition(s)
and the beginning of the instruction(s).
NOTE: Any
number of
IF...THEN...ELSIF...THEN...END_IF
instructions
may be nested to generate complex selection instructions.Example ELSIF...THEN
IF A>B THEN
C:=SIN(A) * COS(B) ;
B:=SUB(C,A) ;
ELSIF A=B THEN
C:=ADD(A,B) ;
B:=MUL(C,A) ;
END_IF ;
For Example Nested Instructions
IF A>B THEN
IF B=C THEN
C:=SIN(A) * COS(B) ;
ELSE
B:=SUB(C,A) ;
END_IF ;
ELSIF A=B THEN
C:=ADD(A,B) ;
B:=MUL(C,A) ;
ELSE
C:=DIV(A,B) ;
END_IF ;