Python continue Statement

Python continue statement skips the rest of the code inside a loop for the current iteration in a Loop and jumps the program execution to the beginning of the enclosing loop.

If the continue statement is inside a nested loop (one loop inside another loop), the continue statement skips only the current iteration of the enclosing loop.

Python continue Statement Example

Gives is a Python program which iterates over a list of numbers and prints only odd numbers.

The if statement‘s conditional expression checks for the number if the current number is odd or even. When an even number is checked, the continue statement is executed and program execution jumps to the beginning of the loop.

In case of odd numbers, the program prints the number into the console.

for i in [1,2,3,4,5,6]:
    if i % 2 == 0:
    print(i, " ")

print("Statement after loop body")

Program output.

Statement after loop body

Flowchart of continue Statement

The flowchart of the continue statement in a Python for loop.

Python continue statement flowchart
Python continue statement flowchart

Happy Learning !!

Was this post helpful?

Join 7000+ Awesome Developers

Get the latest updates from industry, awesome resources, blog updates and much more.

* We do not spam !!

Leave a Comment


A blog about Java and related technologies, the best practices, algorithms, and interview questions.