久久国产亚洲欧美日韩精品,国产精品一区在线麻豆,国产拍揄自揄精品视频网站,欧美日本一区二区三区免费,无码福利视频,亚洲无码视频喷水,亚洲三级色,亚洲狠狠婷婷综合久久久久

Lua中if ... else語句的詳解用法

2020-08-28 句子

  if 語句后面可以跟一個可選的else語句,當布爾表達式為假該語句執行。

  語法

  在Lua編程語言中的if ... else語句的語法是:

  代碼如下:

  if(boolean_expression)

  then

  --[ statement(s) will execute if the boolean expression is true --]

  else

  --[ statement(s) will execute if the boolean expression is false --]

  end

  如果布爾表達式的值為true,那么if代碼塊將被執行,否則else代碼塊將被執行。

  Lua程序設計語言假定布爾true和非零值的任意組合作為true,以及它是否是布爾假或零,則假定為false值。但應當注意的是,在Lua零值被視為true。

  例如:

  代碼如下:

  --[ local variable definition --]

  a = 100;

  --[ check the boolean condition --]

  if( a < 20 )

  then

  --[ if condition is true then print the following --]

  print("a is less than 20" )

  else

  --[ if condition is false then print the following --]

  print("a is not less than 20" )

  end

  print("value of a is :", a)

  當建立和運行上面的代碼,它會產生以下結果。

  代碼如下:

  a is not less than 20

  value of a is : 100

  if...else if...else 語句

  if語句后面可以跟一個可選的'else if ... else語句,這是非常有用的使用,以測試各種條件單個if...else if 語句。

  當使用if , else if , else語句有幾點要記住使用:

  if 可以有零或一個 else ,但必須在elseif之前。

  if 之后可以有零到很多else if在else之前。

  一旦一個else if成功,其它的elseif將不會被測試。

  語法

  if...else if...else...else語句在Lua編程語言的語法是:

  代碼如下:

  if(boolean_expression 1)

  then

  --[ Executes when the boolean expression 1 is true --]

  else if( boolean_expression 2)

  --[ Executes when the boolean expression 2 is true --]

  else if( boolean_expression 3)

  --[ Executes when the boolean expression 3 is true --]

  else

  --[ executes when the none of the above condition is true --]

  end

  例如:

  代碼如下:

  --[ local variable definition --]

  a = 100

  --[ check the boolean condition --]

  if( a == 10 )

  then

  --[ if condition is true then print the following --]

  print("Value of a is 10" )

  elseif( a == 20 )

  then

  --[ if else if condition is true --]

  print("Value of a is 20" )

  elseif( a == 30 )

  then

  --[ if else if condition is true --]

  print("Value of a is 30" )

  else

  --[ if none of the conditions is true --]

  print("None of the values is matching" )

  end

  print("Exact value of a is: ", a )

  當建立和運行上面的代碼,它會產生以下結果。

  代碼如下:

  None of the values is matching

  Exact value of a is: 100

【Lua中if ... else語句的詳解用法】相關文章:

《易經》中的經典語句06-21

《答謝中書書》作者詳解03-14

詩經中的唯美語句04-24

詩經中的優美語句04-19

顧城作品中的經典語句09-19

答謝中書書早晚美景的語句12-11

余光中散文精彩語句01-07

陸游的詩詞中的經典語句03-11

觀滄海的意思詳解01-10

《觀潮》生字詳解11-14

每次都冷淡到我自己都不認識我語句 評價老師的語句參考
主站蜘蛛池模板: 欧美日韩亚洲综合在线观看 | 国产精品污污在线观看网站| 精品人妻无码区在线视频| 国产日韩欧美在线视频免费观看| 中国毛片网| 91口爆吞精国产对白第三集| 欧美日韩va| 2021国产精品自产拍在线观看| 久久久波多野结衣av一区二区| 国产成人精品一区二区免费看京| 久久一色本道亚洲| 国产99精品久久| 天堂av高清一区二区三区| 国产一区二区三区免费| 青青草一区| 国产福利免费观看| 国产欧美精品午夜在线播放| 国产自在线播放| 国产欧美视频在线观看| 久久综合色视频| 中文字幕 91| 亚洲视频免费在线看| 亚洲美女一区二区三区| 欧美翘臀一区二区三区| 99视频在线免费观看| 日韩色图区| 亚洲免费人成影院| 亚洲青涩在线| 成人国产免费| 91网址在线播放| 欧美中文一区| 国产精品视频第一专区| 国产一区自拍视频| 午夜福利视频一区| 久久黄色毛片| 久久中文无码精品| 美女无遮挡免费网站| 一级黄色片网| 久久亚洲国产最新网站| 亚洲另类第一页| 婷婷综合在线观看丁香| 亚洲欧美天堂网| 无码AV高清毛片中国一级毛片| 国产精品女熟高潮视频| 国产sm重味一区二区三区| 久久综合亚洲鲁鲁九月天| 美女亚洲一区| 好吊色妇女免费视频免费| 91精品啪在线观看国产91| 玩两个丰满老熟女久久网| 久热99这里只有精品视频6| 亚洲免费福利视频| 玖玖精品视频在线观看| 天天躁狠狠躁| 三上悠亚精品二区在线观看| 久久国语对白| 国产av一码二码三码无码| 国产亚洲精品在天天在线麻豆| 欧美亚洲一区二区三区导航| 2021亚洲精品不卡a| 欧美日在线观看| 久久99精品久久久久纯品| 国产原创第一页在线观看| www.精品国产| 色综合久久综合网| 久久99精品久久久久纯品| 91po国产在线精品免费观看| 国产精品综合色区在线观看| 亚洲a级在线观看| 亚洲妓女综合网995久久| 久久亚洲高清国产| 青青久在线视频免费观看| 免费Aⅴ片在线观看蜜芽Tⅴ| 亚洲不卡影院| 久久综合九九亚洲一区| 国产亚洲成AⅤ人片在线观看| 亚洲国产看片基地久久1024| 成年女人18毛片毛片免费| 天天综合网亚洲网站| 亚洲一级毛片| 亚洲av片在线免费观看| 操美女免费网站|