In a FOR, FOREACH, or WHILE loop, you can use a CONTINUE or EXIT statement to control the execution of the loop.
CONTINUE causes the routine to skip the statements in the rest of the loop and move to the next iteration of the FOR statement. EXIT ends the loop and causes the routine to continue executing with the first statement following END FOR. Remember that EXIT must be followed by the keyword of the loop the routine is executing—for example, EXIT FOR or EXIT FOREACH.
Figure 414 shows examples of CONTINUE and EXIT within a FOR loop.
FOR i = 1 TO 10 IF i = 5 THEN CONTINUE FOR; . . . ELIF i = 8 THEN EXIT FOR; END IF; END FOR;