当前位置: 首页 > news >正文

无涯教程-Lua - 嵌套if语句函数

在Lua编程中,您可以在另一个if or else if语句中使用一个if or else if语句。

nested if statements - 语法

嵌套if 语句的语法如下-

if( boolean_expression 1)
then--[ Executes when the boolean expression 1 is true --]if(boolean_expression 2)then--[ Executes when the boolean expression 2 is true --]end
end

您可以像嵌套 if 语句一样,嵌套 else if ... else

nested if statements - 示例

--[ local variable definition --]
a=100;
b=200;--[ check the boolean condition --]if( a == 100 )
then--[ if condition is true then check the following --]if( b == 200 )then--[ if condition is true then print the following --]print("Value of a is 100 and b is 200" );end
endprint("Exact value of a is :", a );
print("Exact value of b is :", b );

当您构建并运行以上代码时,它将产生以下输出。

Value of a is 100 and b is 200
Exact value of a is :	100
Exact value of b is :	200

Lua 中的 嵌套if语句函数 - 无涯教程网无涯教程网提供在Lua编程中,您可以在另一个if or else if 语句中使用一个if or else if 语句。 nest...https://www.learnfk.com/lua/nested-if-statements-in-lua.html

http://www.lryc.cn/news/109911.html

相关文章:

  • vue v-slot指令
  • 【机器学习】西瓜书学习心得及课后习题参考答案—第6章支持向量机
  • 无涯教程-Perl - 面向对象
  • Linux安装VScode
  • 网络安全(黑客)工具篇
  • 测试工程师刚入职如何快速熟悉需求并输出测试用例?
  • 2023上半年手机及数码行业分析报告(京东销售数据分析)
  • Opencv-C++笔记 (14) : 霍夫变换(直线、圆)
  • 栈和队列(一) 栈操作详解
  • 软考A计划-系统集成项目管理工程师-信息系统安全管理-下
  • Spark知识点总结
  • vue el-input 使用 回车键会刷新页面的问题
  • 【ARM64 常见汇编指令学习 12 -- ARM 汇编函数 的学习】
  • linux下软件安装 - 与GPT对话
  • idea 2023 新版ui中git的相关操作
  • vue3—SCSS的安装、配置与使用
  • Godot 4 源码分析 - Path2D与PathFollow2D
  • ardupilot 中坐标变换矩阵和坐标系变换矩阵区别
  • VR内容研发公司 | VR流感病毒实验虚拟现实课件
  • python——案例10:认识if、elif、else
  • Hadoop中命令检查hdfs的文件是否存在
  • 计算机网络用户接入层设计
  • 全志F1C200S嵌入式驱动开发(应用程序开发)
  • 人工智能学习07--pytorch23--目标检测:Deformable-DETR训练自己的数据集
  • Statefulset 实战 1
  • 没有jodatime,rust怎么方便高效的操作时间呢?
  • 如何把pdf转成cad版本?这种转换方法非常简单
  • MySQL常用函数方法
  • Linux命令200例专栏导读:实用指南助你成为Linux大师
  • ICN6202 MIPIDSI转LVDS桥接芯片的功能及特征 调试文档资料