6   DriveProgramming Commands
6 - 16
DriveProgramming User’s Manual  (I622-E1)
 Example
Ifs/Else/End If
Command Description Argument
If <condition> is met, it executes <command set 
1> right after this command until the “else” com-
mand, and goes to the next step after the “endif” 
command.
If <condition> is not met, it executes <command 
set 2> right after the “else” command until the 
“endif” command, and goes to the next step 
after the “endif” command.
Condition
: a comparison between two variables 
or constants with the format <left hand value> 
<comparison operator> <right hand value>.
• Left hand value: any variable or constant 
(range −128 to 127)
• Comparison operator: =, <, >, <=, >=, or <>
• Right hand value: any variable or constant 
(range −128 to 127)
Command set 1: one or more commands until 
the “else” command. It can contain nested com-
mands (up to eight levels).
Command set 2: one or more commands until 
the “endif” command. It can contain nested 
commands (up to eight levels).
Format
Flowchart method Text language method
if <condition> then
<command set 1>
else
<command set 2>
endif
Flowchart Text
Block number
Operation
1 to 5 If U(00) is greater than U(01), it assigns 20 to U(03) right after the “if” and jumps to the “endif” com-
mand. If U(00) is not greater than U(01), it assigns 10 to U(03) right after the “else” command and 
goes to the “endif” command.
6 Jumps to the block 1: loop_ unconditionally.