python3中continue用法


python3中continue釋義

continue作用是結束本輪循環並繼續下一輪循環

具體代碼如下:

1 count=0
2 while count<100:                  #count小於100時進入while循環
3     count+=1
4     if count>5 and count<96:    #count滿足大於5小於96時終止此次循環開始下次循環
5         continue   
6     print('loop',count)
7 print('.....out of loop while....')    

執行結果為:

1
2
3
4
5
96
97
98
99
100
......out of while loop.....

Process finished with exit code 0

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM