Thursday, June 18, 2020

The Beginner's Guide to Python Continue Statement

Hello guys! Welcome back to another section of my 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 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 the white and for loops.


Below is the syntax to use a continue statement in Python -


Flow Chart


The following below is a very simple example -


for letter in 'Python':     # First Example
   if letter == 'h':
   print 'Current Letter :', letter

var = 10                    # Second Example
while var > 0:              
   var = var -1
   if var == 5:
   print 'Current variable value :', var
print "Welcome to Web design tutorialz!"


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!

Alright guys! This is where we are rounding up for this tutorial post. In my next tutorial, we are going to be discussing 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.


Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.