omron — NEXT program instruction

NEXT program instruction NEXT program instruction Syntax NEXT count Function Branch to the END statement of the nth nested loop, perform the loop test, and loop if appropriate. Usage Considerations This instruction can be used with the FOR, WHILE, and DO control structures. Parameter count Optional integer specifying the number of nested structures to branch to the END of (expressions and variables are not acceptable). Details When a NEXT instruction is processed with count = 1, execution continues at the END of the control structure. If count > 1, execution continues at the END of count number of nested control structures.

Example If error = 1, branch to the END of the innermost control structure. If error = 2, branch to the END of the outermost control structure: 45 FOR i = 1 to 20 46 FOR j = 1 to 10 47 FOR k = 10 to 50 48 IF error == 1 THEN 49 NEXT ;branch to step 54 50 END 51 IF error == 2 THEN 52 NEXT 3 ;branch to step 56 53 END 54 END 55 END 56 END 57 Related Keywords DO program instruction eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 358