Continue Statement¶
The continue statement gives you the option to skip over the part of a loop where an external condition is triggered, but to go on to complete the rest of the loop. That is, the current iteration of the loop will be disrupted, but the program will return to the top of the loop. The continue statement will be within the block of code under the loop statement, usually after a conditional if statement.
The continue statement (in most computer programming languages) takes the generic form of:
WHILE bolean expression
counter = counter + 1
statement_1
statement_2
…
IF bolean expression THEN
CONTINUE
ENDIF
END
FOR counter in range(n)
counter = counter + 1
statement_1
statement_2
…
IF bolean expression THEN
CONTINUE
ENDIF
END
The flowchart for a Continue statement will look like this:
The following code snippet is a continue program: