迷你世界Lua的repeatuntil迴圈Lua程式語言中repeatuntil迴圈語句不同於for和while迴圈,for和while迴圈的條件語句在當前迴圈執行開始時判斷,而repeatuntil迴圈的條件語句在當前迴圈結束後判斷。
詳細答案:
概述:
Lua 程式語言中 repeatuntil迴圈語句不同於for和while迴圈,for和while迴圈的條件語句在當前迴圈執行開始時判斷,而 repeatuntil迴圈的條件語句在當前迴圈結束後判斷。
--例項:
a = 0
--[ 執行迴圈 --]
repeat
Chat:sendSystemMsg(a,0)
a = a + 1
until(a>5) --迴圈直到a>5
--輸出結果為:
-- 0
-- 1
-- 2
-- 3
-- 4
-- 5