- while 条件 do 语句 end
num=0; while num <5 do num=num+1 print(num) end
- repeat 语句 until 结束条件
repeat num=num+1 print(num) until num>5
- for 变量=开始值,结束值,变量自增值 do 语句 end
for i=1,5,2 do --i每次增加2 print(i) end
Lua循环
最新推荐文章于 2024-11-06 20:50:31 发布
num=0; while num <5 do num=num+1 print(num) end
repeat num=num+1 print(num) until num>5
for i=1,5,2 do --i每次增加2 print(i) end