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

 

 

 

 

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