Python continue statement

After reading this Python continue statement topic, you will know the continue statement flowchart, theory, and examples, and you will understand how to use continue statement with the loop.

Python continue statement generally used with conditional statements such as if statement within the loop (like for loop and while loop). The continue statement skips all statements written after it as well as transfer the program control to the next iteration of the loop.

Python continue statement Syntax:

The syntax of continue statement is given below,

continue

continue statement flowchart:

The flow chart of continue statement is given below,

Example

Program (1): To demonstrate the use of continue statement.

i = 0
while i < 5:
  i += 1 
  if i == 5:
    #skip the loop value i=5 reach
    continue
  print(i)
  print("How are you")

Output (1)

1
How are you
2
How are you
3
How are you
4
How are you

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

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