首页 > 其他 > 详细

LUA逻辑运算符OR的使用

时间:2017-08-18 16:44:21      阅读:272      评论:0      收藏:0      [点我收藏+]
function CheckValue(str_value, int_value)
	local msg;

	--逻辑运算符的使用
	if (int_value < 0) or (str_value == ‘ ‘)  then
		msg = 0;
	else
		msg = 1;
	end


	return msg;
end


in_str = io.read();
in_int = 1;


status = CheckValue(in_str, in_int);

if status == 1 then
	print("all input");
else
	print("has error");
end

  

LUA逻辑运算符OR的使用

原文:http://www.cnblogs.com/ReacherGua/p/7390397.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!