Hello dear readers! Welcome back to another edition of our tutorial on Python. In this tutorial guide, we are going to be studying about the Python Continue Statement.
Python continue statement returns control to the beginning of the while loop. The Python continue statement rejects all the remaining statements in the current iteration of the loop and moves all control back to the top of the loop.
The continue statement can be used in both while and for loops.
Python continue statement returns control to the beginning of the while loop. The Python continue statement rejects all the remaining statements in the current iteration of the loop and moves all control back to the top of the loop.
The continue statement can be used in both while and for loops.
Syntax
Following is the syntax to use a continue statement in Python -
continue
RECOMMENDED POST: A Guide to Python Break Statement
Flow Chart
Example
Following below is a very simple example -
#!/usr/bin/python for letter in 'Python': # First Example if letter == 'h': continue print 'Current Letter :', letter var = 10 # Second Example while var > 0: var = var -1 if var == 5: continue print 'Current variable value :', var print "Welcome to Web design tutorialz!"
Output
Below is the output of the above example -
Current Letter : P Current Letter : y Current Letter : t Current Letter : o Current Letter : n Current variable value : 9 Current variable value : 8 Current variable value : 7 Current variable value : 6 Current variable value : 4 Current variable value : 3 Current variable value : 2 Current variable value : 1 Current variable value : 0 Welcome to Web design tutorialz!
RECOMMENDED: Python Variables and Data Types
Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial, we are going to be studying about the Python pass statement.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.