Tools, FAQ, Tutorials:
'continue' Statement in Repeating Statement Blocks
How to use the "continue" statement in a repeating statement block in Python code?
✍: FYIcenter.com
The "continue" statement can be used in a repeating statement block like "for" and "while" loops
to continue with the next looping item immediately.
When a "continue" statement is interpreted, Python will skip the rest of the statement block of the nearest "for" or "while" loop, and continue with its next iteration.
For example:
>>> for num in range(2, 10):
... if num % 2 == 0:
... print("Found an even number "+str(num))
... continue
... print("Found a number "+str(num))
...
Found an even number 2
Found a number 3
Found an even number 4
Found a number 5
Found an even number 6
Found a number 7
Found an even number 8
Found a number 9
⇒ 'pass' - Do Nothing Statements
⇐ 'break' Statement in Repeating Statement Blocks
2017-09-12, ∼1912🔥, 0💬
Popular Posts:
How to access URL template parameters from "context.Request.Matched Parameters"object in Azure API P...
Where to find EPUB Sample Files? Here is a list of EPUB sample files collected by FYIcenter.com team...
How to decode the id_token value received from Google OpenID Connect authentication response? Accord...
How to read RSS validation errors at w3.org? If your RSS feed has errors, the RSS validator at w3.or...
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...