| Home | Previous Lesson: Exit Statement Next Lesson: Special Characters |
The CONTINUE statement is similar to the EXIT statement. Instead of exiting a loop, however, CONTINUE restarts a loop in a new iteration. The CONTINUE statement has a syntax that is just as simple as the EXIT statement:
CONTINUE
Because it causes a loop to continue, this statement is legal only if it appears within one of loop statements such as DO�LOOP, FOR�NEXT. When the CONTINUE statement is executed, the current iteration of the enclosing loop is terminated and the next iteration begins. This means different things for different types of loops:
The following example shows a CONTINUE statement being used to exit the current iteration of a loop when an error occurs:
li_TotalItems = UpperBound(ls_Array)
FOR i = li_TotalItems Step 1
IF IsNull(ls_Array[i]) Then CONTINUE
li_ValidItems++
NEXT
| Home | Previous Lesson: Exit Statement Next Lesson: Special Characters |