Nesting if conditional statements, Command format - if, else and endif – Yaskawa LEGEND-MC User Manual
Page 304
294
LEGEND-MC User’s Manual
command only when the argument of the IF command evaluates False. The ELSE command must occur
after an IF command and has no arguments. If the argument of the IF command evaluates false, the
controller will skip commands until the ELSE command. If the argument for the IF command evaluates
true, the controller will execute the commands between the IF and ELSE command.
Nesting IF Conditional Statements
The LEGEND-MC allows IF conditional statements to be included within other IF conditional statements.
This technique is known as 'nesting' and the LEGEND-MC allows up to 255 IF conditional statements to
be nested. This is a very powerful technique allowing the user to specify a variety of different cases for
branching.
Command Format - IF, ELSE and ENDIF
Format:
Meaning
IF
Execute commands proceeding IF command (up to ELSE command) if con-
ditional statement(s) is true, otherwise continue executing at ENDIF com-
mand or optional ELSE command.
ELSE
Optional command. Allows for commands to be executed when argument of
IF command evaluates not true. Can only be used with IF command.
ENDIF
Command to end IF conditional statement. Program must have an ENDIF
command for every IF command.