Python Continue Statement

Last Updated : 14 Apr 2026

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.

What is Python Continue Statement?

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.

Python Continue Statement

Syntax of Continue Statement

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.

Simple Continue Statement Example

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.

Execute Now

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.

Flowchart (Working) of continue Statement

The image below shows the working of the continue statement in Python.

Python Continue Statement
  • Step 1: The loop starts.
  • Step 2: The loop condition is checked.
  • Step 3: If the continue condition is met, the remaining code in the loop is skipped.
  • Step 4: The loop immediately moves to the next iteration.
  • Step 5: If the condition is not met, the remaining code inside the loop runs normally.
  • Step 6: This process repeats until the loop ends.

More Examples of continue Statement

In the following examples, we will see how to use the continue statement in different situations within loops.

Example 1: Skipping Specific Values

Let us take an example to demonstrate how to skip specific value in Python using continue statement.

Execute Now

Output:

Pythn Prgramming

Explanation:

Here, the letter 'o' is skipped whenever it appears in the string.

Example 2: Skipping Iterations in a while Loop

Let us take an example to demonstrate how to skip iterations in while loop using the continue statement.

Execute Now

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.

Example 3: Skipping Negative Numbers in a List

Let us take an example to demonstrate how to skip negative numbers in a list using the continue statement.

Execute Now

Output:

10
5
7

Explanation:

In this example, negative numbers are skipped, and only positive numbers are printed.

Example 4: Skipping Certain Words in a Sentence

Let us take an example to demonstrate how to skip certain words in a sentence using the continue statement.

Execute Now

Output:

Python learn Tpointtech

Explanation:

Here, the words "from" and "a" are skipped while printing the rest of the sentence.

Example 5: Skipping Multiples of 3 in a Range

Let us take an example to demonstrate how to skip multiples of 3 in a range using the continue statement.

Execute Now

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.

Example 6: Skipping Empty Strings in a List

Let us take an example to demonstrate how to skip empty strings in a list using the continue statement.
Execute Now

Output:

apple
banana
cherry

Next TopicPython Break