while True 死循环

时间:2023-03-10 05:37:18
while True 死循环
 while True 死循环示例:

 count = 0                                    #给count设置变量为0
while True:
count += 1 #每循环一次,count+1 ; count += 1 等同于count = count+1 意思是一样的
if count >=50 and count <=60: #对比count的值,设置循环中50-60之间的字符不打印
continue #如果条件匹配,到这里就不往下执行了,continue回到起点
print ("张江华",count) #打印,count 输出打印的次数
if count ==100: #循环如果到100次,就跳出循环
print ("已经循环够了100次,退出循环!")
break