每种语言都是这些复合结构,Lua也没啥特别的东西,这里仅列举一下:
1if … then
elseif … then
 …
elseif … then
 …
else
end
2while … do
   end
3for … do
   end
4repeat
         …
   until …
5break
6do
   end
注意几点:在每个结构后都有 end 表示结束,没有括号包围语句体;判断表达式不用括号包围,而是在后面使用关键词 then, do 等; for 的条件表达式一般设置形式是 for num = start_num, end_num, step do ,这里的 step 可以省略,默认为 1 repeat…until 结构类似于其他语言的 do…while