當前位置:陽光遊戲站 >

網遊遊戲問答

> 迷你世界Lua的repeatuntil循環,迷你世界Lua的repeatuntil循環是什麼

迷你世界Lua的repeatuntil循環,迷你世界Lua的repeatuntil循環是什麼

迷你世界Lua的repeatuntil循環Lua程式語言中repeatuntil循環語句不同於for和while循環,for和while循環的條件語句在當前循環執行開始時判斷,而repeatuntil循環的條件語句在當前循環結束後判斷。

迷你世界Lua的repeatuntil循環是什麼 迷你世界Lua的repeatuntil循環

詳細答案:

概述

Lua 程式語言中 repeatuntil循環語句不同於for和while循環,for和while循環的條件語句在當前循環執行開始時判斷,而 repeatuntil循環的條件語句在當前循環結束後判斷。

--實例:

迷你世界Lua的repeatuntil循環是什麼 迷你世界Lua的repeatuntil循環 第2張

--以下代碼在聊天框輸出a的值

a = 0

--[ 執行循環 --]

repeat

Chat:sendSystemMsg(a,0)

a = a + 1

until(a>5) --循環直到a>5

--輸出結果為:

-- 0

-- 1

-- 2

-- 3

-- 4

-- 5

  • 文章版權屬於文章作者所有,轉載請註明 https://ygyxz.com/wangyouwenda/pp4y4d.html