Python continue Statement
Python continue Statement
The Python continue statement skips the remaining code inside a loop for the current iteration. The nearest enclosing loop does not terminate but continues with the next iteration or cycle. It skips all the remaining statements in the current iteration of the loop and moves the control back to the beginning of the loop.
Syntax
The general syntax of the continue statement is as follows:
continue
The continue statement can be used with both for and while loops.
Example
Program to illustrate the use of the continue statement.
####################################### # Program to illustrate the continue statement # Python Tutorials - www.TestingDocs.com ####################################### for i in range(1, 10): if i == 7: continue print(i) print("Control out of the for Loop")
Output
1
2
3
4
5
6
8
9
Control out of the for Loop
—
Python Tutorials
Python Tutorial on this website can be found at:
https://www.testingdocs.com/python-tutorials/
More information on Python is available at the official website: