continue语句及小案例

# 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

 

posted @ 2019-07-06 11:14  水果、、  阅读(787)  评论(0编辑  收藏  举报