while条件循环
i=1
while i<= 10:
print(i)
i +=1
#输出:1.2.3.4.5.6.7.8.10
while 语句“判断条件”还可以是个常值/true,表示循环永远进行下去,需要break跳出循环。
i=1
while True:
print('hello')
i+=1
if i>10:
break
输出:hello.hello...hello*10
Python的continue语句跳出来次循环,而break跳出整个循环。
continue语句用来告诉Python 跳过当前循环的剩余语句,然后继续进行下一轮循环。
continue语句用在while和for循环中。