While迴圈

while condition:
    #do something

while迴圈相對單純
它會於condition = True的情況下不斷執行
以下舉幾個範例

i = 0
while i < 6:
    print(i)
    i+=1
#0,1,2,3,4,5

而以上這個例子又同等於 for i in range(6)

results matching ""

    No results matching ""