1.条件分支语句
print("************条件分支语句*****************")
a=15;
--if 条件 then 逻辑语句 end
if a>5 then
print(123);
end
--双
if a<5 then
print("123");
else
print("456");
end
--多
if a<10 then
print("123")
elseif a==15 then
print(a);
elseif a=10 then
print(a);
end
--lua中没有switch
2.循环语句
print("************循环语句*****************")
print("************while语句*****************")
num=0;
while num <5 do
print(num);
num=num+1;
end
print("************do while*****************")
num=0;
repeat
print(num);
num=num+1;
until num>5
print("************for*****************")
for i=1,10 do
print(i)
if i==5 then
break
end
end