Nearby lessons
50 of 159Python - 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
Example 1 - continue Statement
Explanation
When i becomes 5, the continue statement skips that iteration.
The remaining iterations continue normally.
Example 2 - Print Odd Numbers
Example 3 - Print Even Numbers
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 QuestionsProgress: 0 / 2