--条件分支语句
--if条件 then....end
--单分支
a=6
if a>5 then
print('666')
end
--双分支
a=7
if a>8 then
print(true)
else
print(false)
end
--多分支
a=88
if a>60 and a<=70 then
print('及格')
elseif a>70 and a<=80 then --注意在lua中else if需要合在一起写
print('良好')
elseif a>80 and a<=90 then
print('优秀')
elseif a>90 and a<=100 then
print('牛逼')
end
Lua 条件分支语句
最新推荐文章于 2024-04-21 22:06:03 发布