Features II                     JS/JSR4400N SCARA Robot 
JSG GANTRY Robot 
JR2000N Desktop Robot 
75
FOR, DO-LOOP 
         
 
■ for, do-loop: for, next, exitFor, do, loop, exitDo 
    
 
Command Category  Command Parameter  Job 
for 
Variable Name,
Initial Value, 
End Value, 
Step Value 
next – 
Repeats commands between for and next 
until the specified variable changes from 
the initial value to the end value. 
exitFor – 
Break from for loop. 
do – 
loop – 
Repeat commands between do and loop. 
for, do-loop 
exitDo – 
Break from do loop. 
 
 
 
■  for … exitFor … next 
The for command specifies the number of repetitions. 
 
 declare num ival 
  for ival=1 to 8 step 1 
   (Contents to be repeated) 
 next 
Declare a local variable ival. 
The initial value of the variable ival is 1. Add 1 to the variable for 
every loop and repeat the commands between for and next until 
the ival becomes 8. 
 
 declare num ival 
  for ival=1 to 8 step 1 
   (Contents to be repeated) 
   if 
     ld #genIn1 
   then 
     exitFor 
   endIf 
 next 
Declare a local variable ival. 
The exitFor command breaks out of the for … next loop and go 
to the command after next. 
 
Condition: If #genIn1=1, break out of the for … next loop even if 
the ival does not become 8 and go to the command after next.