Python1 of continue, break statement

Python in the break and continue the same basic usage

 

continue statement: for out of this cycle, but the cycle continues

break statement: for out of the whole cycle, that is, out of the loop where the break the code

 

continue:

. 1  for NUM in Range (10 ):
 2      IF   NUM. 5 == :
 . 3          Continue 
. 4      Print (NUM)
 . 5 Results:
 . 6  0
 . 7 . 1
 . 8 2
 . 9 . 3
 10 . 4
 . 11 . 6
 12 is . 7
 13 is . 8
 14 . 9

break:

. 1  for NUM in Range (10 ):
 2      IF NUM. 5 == :
 . 3          BREAK 
. 4      Print (NUM)
 . 5  
. 6  results
 . 7  
. 8  0
 . 9 . 1
 10 2
 . 11 . 3
 12 is . 4

 

 

 

Guess you like

Origin www.cnblogs.com/ksht-wdyx/p/11298691.html