Lua 實現 continue

Lua 實現 continue

https://www.runoob.com/note/45233

lua 中沒有 continue 語句有點不習慣。

可以使用類似下面這種方法實現 continue 語句:

for i = 10, 1, -1 do
  repeat
    if i == 5 then
      print("continue code here")
      break
    end
    print(i, "loop code here")
  until true
end

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章