lingojot
@lingojot
Sun, Oct 15, 2017 8:58 AM
Sun, Oct 15, 2017 4:38 PM
[#python]
i = 0
while 1==1:
print(i)
i = i + 1
if i >= 5:
print("Breaking")
break
print("Finished")
lingojot
@lingojot
Sun, Oct 15, 2017 8:59 AM
while Loops, break statement
lingojot
@lingojot
Sun, Oct 15, 2017 8:59 AM
Result:
>>>
0
1
2
3
4
Breaking
Finished
>>>
載入新的回覆
i = 0
while 1==1:
print(i)
i = i + 1
if i >= 5:
print("Breaking")
break
print("Finished")
>>>
0
1
2
3
4
Breaking
Finished
>>>