break and continue
2018-07-21 本文已影响8人
苗_a
for的循环
name = 'dongGe'
for x in name:
print('----')
print(x)
带有break的循环
name = 'dongGe'
for x in name:
print('----')
if x == 'g':
break
print(x)
while的循环
i = 0
while i<10:
i = i+1
print('----')
print(i)
带有break的循环
i = 0
while i<10:
i = i+1
print('----')
if i==5:
break
print(i)#
continue的循环
for的循环 name = 'dongGe'
for x in name:
print('----')
if x == 'g':
continue
print(x)
i = 0
while i<10:
i = i+1
print('----')
if i==5:
continue
print(i)