首页 > 其他 > 详细

continue语句及小案例

时间:2019-07-06 13:19:34      阅读:119      评论:0      收藏:0      [点我收藏+]
# coding:utf-8

# 打印1到10之间的整数,不要把5打印出来

# index = 0
# while index < 10:
# 	index += 1
# 	if index ==5:
# 		continue     #退出此次循环
# 	print(index)


# 打印1-10之间的所有奇数

# index = 0
# while index < 10:
# 	index += 1
# 	if index % 2 ==0:
# 		continue
# 	print(index)
# 结果如下
# 1
# 3
# 5
# 7
# 9

 

continue语句及小案例

原文:https://www.cnblogs.com/lsswudi/p/11142053.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!