Continue Statement in Python

Updated: May 18


The continue statement is used within a loop to skip the rest of the statements in the body of loop for the current iteration and jump to the start of the loop for next iteration. The break and continue statements are opposite each other which are used to change the flow of loop, break terminates the loop when a condition is got and continue leave out the current iteration.

Syntax:

continue

Flow diagram


Example:

program to display only odd numbers

for n in [10, 13, 9, 68, 4, 91, 54]:

if n%2 == 0:

continue

print(n)

Output:

13

9

91