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, ∼2716🔥, 0💬
Popular Posts:
What is the "__init__()" class method? The "__init__()" class method is a special method that will b...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How to start Visual Studio Command Prompt? I have Visual Studio 2017 Community version with Visual C...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...