Python Continue Statement is a loop control statement and mainly used to skip an iteration or ignore that condition. It works opposite to that of a break statement.
Where break statement is instead of terminating the loop and Continue Statement forces to execute the next iteration of the loop.
There are more loop control statements.
- Continue statement
- Break statement
- Pass statement
1. Python continue statement using in for loop
Below is the implementation of the above idea:
for val in "Data": if val == "a": continue print(val) print("The end")
How continue statement works in Loop
2. Python continue statement using in While loop
var = 5 while var > 0: var = var - 1 if var == 2: continue print('Current variable value :', var) print("Good bye!")
Current variable value : 4
Current variable value : 3
Current variable value : 1
Current variable value : 0
Do comment if you have any doubts and suggestions on this tutorial.
Note: This example (Project) is developed in PyCharm 2020.1 (Community Edition)
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
All Python Programs are in Python 3, so it may change its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.