REPEATループ

repeatループでは、各ループの最後でテスト条件を満足しているかどうかが確認されるので、ループが少なくとも1回は実行されます。

Note: 終了条件を満足する前にループを終了するにはbreak文を使用します。
m = 0
repeat
m = m+1
print("Repeat loops check the condition at end, and stops if it is true.")
print("The value of m is " .. m)
if (math.random()*10 > 5) then
print("A random number larger than 5 was generated. Terminating the loop early.")
break -- breaks out of the loop early
end
until m == 5