控制语句 | 格式 | 示例 |
If | if 条件 then ... elseif 条件 then ... else ... end | if 1+1=2 then print("true") elseif 1+2~=3 then print("true") else print("false") end |
While | while 条件 do ... end | while 1+1~=2 do print("true") end |
Repeat | repeat ... until 条件 | repeat print("Hello") until 1+1~=2 |
For | for 变量=初值, 终点值, 步长 do ... end | for i = 1, 10, 2 do print(i) end |
For | for 变量1, 变量2, ... 变量n in 表或迭代函数 do ... end | for a,b in mylist do print(a, b) end |
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/) | Powered by Discuz! X2 |