Previous Up Next

12.3.7  Going to the next iteration of a loop: continue

The continue command will skip the rest of the current iteration of a loop and go to the next iteration.


Example.
If you enter:

S:= 0
for (j:= 1, j <= 10; j++) {
   if (j == 5) {continue;}
   S:= S + j;
}

then S will be 50, which is the sum of the integers from 1 to 10 except for 5, since the loop never gets to S:= S + j when j is equal to 5.


Previous Up Next