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
本文介绍了一种在Lua编程语言中模拟continue语句的方法,通过使用repeat-until结构来跳过循环中的特定迭代,这对于习惯了其他编程语言中有continue语句的开发者来说,提供了一种在Lua中达到相同效果的解决方案。
6304

被折叠的 条评论
为什么被折叠?



