Nearby lessons

50 of 159

Python - Continue Statement

📌 What You Will Learn
  • Define the continue statement and how it skips the current iteration
  • Write a for loop that skips a specific number using continue
  • Print only odd numbers by skipping even values
  • Print only even numbers by skipping odd values
  • Apply continue for skipping invalid records and filtering data

continue Statement

The continue statement skips the current iteration and moves to the next iteration.

The loop does not stop.

Syntax

Loading editor…

Example 1 - continue Statement

Loading editor…

Explanation

When i becomes 5, the continue statement skips that iteration.

The remaining iterations continue normally.

Example 2 - Print Odd Numbers

Loading editor…

Example 3 - Print Even Numbers

Loading editor…

Real World Usage of continue

The continue statement is useful for:

  • Skipping invalid records
  • Ignoring unwanted values
  • Filtering data
📝 Key Takeaways
  • The continue statement skips the current iteration and moves to the next one
  • The loop does not stop when continue is used
  • continue is useful for filtering unwanted values and skipping invalid records
  • The remaining iterations continue normally after continue
  • break stops the loop while continue only skips one iteration

🧠 Test Your Knowledge

2 Questions
Progress: 0 / 2

Finished this lesson?

Mark it as complete to track your progress and see technology completion stats.