for循环和while循环

for循环和while循环

--道心

for循环

name1_list=['daoxin','wuxin','zhixin']
for ele in name1_list:

#找到“wuxin”,打印元素
if ele == "daoxin":
print("find")
continue
#找到“wuxin”,结束循环,打印元素

if ele == 'wuxin' :
print("终于等到你")
break
else:
pass

while循环

count=0
while (count<9):
print("the count is :",count)
count=count+1
print("Good bye")

上一篇:PHP foreach()跳出本次或当前循环与终止循环方法


下一篇:第十节,While循环和for循环