lua中的判读语句三个关键字 if,else, elseif, end判读语句的三种格式:一、、if 表达式 then 语句块 end 二、if 表达式 then 语句块1 else 语句块2end三、只能有一个if和elseif 表达式1 then 语句块1elseif 表达式2 then语句块2elseif 表达式3 then语句块3。。。else 语句块NendFor example One:function ceshi(num) if(num == "hello") then print("hello") else print("num:"__num) endenda = "lala"ceshi(a)For example Two:local today = 1if today == 1 then print(“Today is Monday!”)elseif today == 2 then print(“Today is Tuesday!”)elseif today == 3 then print(“Today is Wednesday!”)elseif today == 4 then print(“Today is Thursday!”)elseif today == 5 then print(“Today is Saturday!”)elseif today == 6 or today == 7 then print(“Rest!”)else print(“None!”)end总结
以上是内存溢出为你收集整理的Lua初识(4)_判断语句全部内容,希望文章能够帮你解决Lua初识(4)_判断语句所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)