/lua.lua Secret
Created
May 6, 2021 15:40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = 0 | |
-- while loop用法是 while (condition) do ... end | |
while true do | |
i = i + 1 | |
print('i= ' .. i) | |
-- %是取餘數,如果是雙數的話,就直接從新進入迴圈(continue) | |
if i % 2 == 0 then | |
print('continue') | |
-- 因為lua沒有continue的功能,所以通常大家都會用goto來模擬 | |
goto continue | |
elseif i == 3 then | |
print('break') | |
-- 可以用break直接離開迴圈 | |
break | |
end | |
print('end') | |
::continue:: | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment