Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Control statement in python
  5. Use of continue in python

Use of continue in python

The continue statement is another control statement like the break statement as both statements skip over a part of code. But the continue statement is somewhat different from break.

Instead of forcing termination, the continue statement forces the next iteration of the loop to take place, skipping any code in between.

continue syntax in while loop:-

while expression1:
     statement1
     if expression:
        continue
     statement2

continue syntax in for loop:-

for variable in sequence:
    statement1
    if expression:
        continue
    statement2

e.g.,

for a in "pythonpoint":
    if a == "h":
        continue
    print(a)
Output- 
p
y
t
o
n
p
o
i
n
t

This is all about continue in python.

Was this article helpful to you? Yes No

How can we help?