Python continue

tejaswini2004's avatar
Published Jun 17, 2025
Contribute to Docs

The continue keyword in Python is used inside loops to bypass the remaining code in the current iteration and immediately begin the next one. When Python encounters continue, it jumps to the next iteration without executing the remaining statements in the loop body. This allows certain conditions to bypass parts of the loop without exiting it completely. It is useful for filtering out unwanted values, skipping invalid data, or focusing on specific cases within loops.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

continue

Parameters:

The continue statement does not take any parameters.

Return value:

The continue statement does not return any value. It simply skips to the next iteration of the nearest enclosing loop.

Note: Unlike break, continue does not exit the loop - it only skips the current iteration.

Example: Using continue in a while Loop

This example demonstrates how the continue statement skips the iteration when the count reaches 3, preventing it from being printed:

count = 0
while count < 5:
count += 1
if count == 3:
continue
print(count, end = ' ')

The output of this code is:

1 2 4 5

Codebyte Example: Skipping Even Numbers Using continue

This codebyte example defines a function that prints only odd numbers from 0-9 by using the continue statement to skip even numbers in a for loop:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours