Python continue statement is used to skip the current iteration of a loop and move to the next one. In this chapter, you will learn about the Python continue statement, how it works, and how to use it in loops.
The continue statement is used to skip the remaining code inside a loop for the current iteration and move to the next iteration. It is used in both for and while loops when we want to ignore certain conditions without stopping the loop.

The syntax of the Python continue statement is as follows:
Syntax Explanation
When the continue statement is executed, it skips the remaining code in the current iteration and moves to the next iteration of the loop. In nested loops, the continue statement only affects the inner loop where it is used.
Let’s see a simple example to understand how the continue statement works.
In the following example, we are skipping even numbers and printing only odd numbers using the continue statement.
Output:
1 3 5 7 9
Explanation:
In this example, the loop runs from 1 to 10. When a number is even, the continue statement skips the print() statement and moves to the next iteration. As a result, only odd numbers are printed.
The image below shows the working of the continue statement in Python.

In the following examples, we will see how to use the continue statement in different situations within loops.
Let us take an example to demonstrate how to skip specific value in Python using continue statement.
Output:
Pythn Prgramming
Explanation:
Here, the letter 'o' is skipped whenever it appears in the string.
Let us take an example to demonstrate how to skip iterations in while loop using the continue statement.
Output:
1 2 3 4 6 7 8 9 10
Explanation:
When x equals 5, the continue statement prevents print(x) from executing, and the loop proceeds with the next iteration.
Let us take an example to demonstrate how to skip negative numbers in a list using the continue statement.
Output:
10 5 7
Explanation:
In this example, negative numbers are skipped, and only positive numbers are printed.
Let us take an example to demonstrate how to skip certain words in a sentence using the continue statement.
Output:
Python learn Tpointtech
Explanation:
Here, the words "from" and "a" are skipped while printing the rest of the sentence.
Let us take an example to demonstrate how to skip multiples of 3 in a range using the continue statement.
Output:
1 2 4 5 7 8 10 11 13 14 16 17 19
Explanation:
This example skips numbers that are multiples of 3 while printing the rest.
Output:
apple banana cherry
We request you to subscribe our newsletter for upcoming updates.