What is Continue Statement in Python?


This is a loop control statement that forces the loop to execute the next iteration while skipping the rest of the code. 

For the current iteration alone, the code in the loop after the continue statement is ignored, and the loop’s next iteration begins when the continue statement is invoked in the loop.

Syntax: 

continu

Example:

i = 0

while i < 7:

   i += 1

  if i == 4:

    continue

  print(i)

Output:

0

1

2

3

5

6


Leave a Reply

Your email address will not be published. Required fields are marked *