Python uses the continue statement to jump out of the loop, and the break jumps out of the loop. The continue statement tells Python to skip the remaining statements of the current loop, and then proceed to the next round of loops. The continue statement is used in the while and for loops.
The Python language continue statement syntax format is as follows:
Copy Code code as follows:
Second, the logical flow chart:
Third, the use of examples:
Copy Code code as follows:
#!/usr/bin/python
For letter in ' Python ': # Example
If letter = = ' h ':
Continue
print ' Current letter: ', letter
var = ten # Second Example
While var > 0:
var = var-1
If var = 5:
Continue
print ' current variable value: ', var
Print "Good bye!"
The above example performs the result:
Copy Code code as follows:
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
Good bye!