HowToDoInJava

  • Python
  • Java
  • Spring Boot
  • Dark Mode
Home / Python / Python Flow Control / Python continue Statement

Python continue Statement

Python continue statement skips the rest of the code inside a loop for the current iteration in a Loop and jumps the program execution to the beginning of the enclosing loop.

If the continue statement is inside a nested loop (one loop inside another loop), the continue statement skips only the current iteration of the enclosing loop.

Python continue Statement Example

Gives is a Python program which iterates over a list of numbers and prints only odd numbers.

The if statement‘s conditional expression checks for the number if the current number is odd or even. When an even number is checked, the continue statement is executed and program execution jumps to the beginning of the loop.

In case of odd numbers, the program prints the number into the console.

for i in [1,2,3,4,5,6]:
    if i % 2 == 0:
        continue
    print(i, " ")

print("Statement after loop body")

Program output.

1  
3  
5  
Statement after loop body

Flowchart of continue Statement

The flowchart of the continue statement in a Python for loop.

Python continue statement flowchart
Python continue statement flowchart

Happy Learning !!

Was this post helpful?

Let us know if you liked the post. That’s the only way we can improve.
TwitterFacebookLinkedInRedditPocket

About Lokesh Gupta

A family guy with fun loving nature. Love computers, programming and solving everyday problems. Find me on Facebook and Twitter.

Comments are closed on this article!

Search Tutorials

Python Tutorial

  • Python Introduction
  • Python Install in Sublime
  • Python Keywords
  • Python Comments
  • Python Variables
  • Python Data Types
  • Python Type Conversion
  • Python References
  • Python Examples

Python Flow Control

  • Python if…else
  • Python for Loop
  • Python while Loop
  • Python break
  • Python continue
  • Python pass

Python Datatypes

  • Python Integer
  • Python String
  • Python List
  • Python Tuple
  • Python Set
  • Python Dictionary
  • Python OrderedDict
  • Python MultiDict
  • Python Priority Queue

Python Advanced Topics

  • Python Lists vs Tuples
  • Python Comparing Tuples
  • Python Unpacking Tuples
  • Python CSV Files

Python Libraries

  • Python Httplib2

Meta Links

  • About Me
  • Contact Us
  • Privacy policy
  • Advertise
  • Guest and Sponsored Posts

Recommended Reading

  • 10 Life Lessons
  • Secure Hash Algorithms
  • How Web Servers work?
  • How Java I/O Works Internally?
  • Best Way to Learn Java
  • Java Best Practices Guide
  • Microservices Tutorial
  • REST API Tutorial
  • How to Start New Blog

Copyright © 2020 · HowToDoInjava.com · All Rights Reserved. | Sitemap

  • Sealed Classes and Interfaces