最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Lua中關(guān)系運(yùn)算符的使用教程

 更新時(shí)間:2015年05月28日 09:41:02   投稿:goldensun  
這篇文章主要介紹了Lua中關(guān)系運(yùn)算符的使用教程,是Lua學(xué)習(xí)入門中的基礎(chǔ)知識(shí),需要的朋友可以參考下

下表列出了所有的Lua語(yǔ)言支持的關(guān)系運(yùn)算符。假設(shè)變量A持有10和變量B持有20則:

201552893006602.jpg (626×426)

示例

試試下面的例子就明白了所有的Lua編程語(yǔ)言提供的關(guān)系運(yùn)算符:

復(fù)制代碼 代碼如下:
a = 21
b = 10

if( a == b )
then
   print("Line 1 - a is equal to b" )
else
   print("Line 1 - a is not equal to b" )
end

if( a ~= b )
then
   print("Line 2 - a is not equal to b" )
else
   print("Line 2 - a is equal to b" )
end

if ( a < b )
then
   print("Line 3 - a is less than b" )
else
   print("Line 3 - a is not less than b" )
end

if ( a > b )
then
   print("Line 4 - a is greater than b" )
else
   print("Line 5 - a is not greater than b" )
end

-- Lets change value of a and b
a = 5
b = 20
if ( a <= b )
then
   print("Line 5 - a is either less than or equal to  b" )
end

if ( b >= a )
then
   print("Line 6 - b is either greater than  or equal to b" )
end

當(dāng)建立并執(zhí)行上面的程序它會(huì)產(chǎn)生以下結(jié)果:

復(fù)制代碼 代碼如下:
Line 1 - a is not equal to b
Line 2 - a is not equal to b
Line 3 - a is not less than b
Line 4 - a is greater than b
Line 5 - a is either less than or equal to  b
Line 6 - b is either greater than  or equal to b

相關(guān)文章

  • 在Mac OS中安裝Lua的教程

    在Mac OS中安裝Lua的教程

    這篇文章主要介紹了在Mac OS中安裝Lua的教程,盡管基于Unix的Mac OS并沒(méi)有集成Lua解釋器,但安裝起來(lái)依然super easy:)需要的朋友可以參考下
    2015-07-07
  • Lua學(xué)習(xí)筆記之?dāng)?shù)據(jù)結(jié)構(gòu)

    Lua學(xué)習(xí)筆記之?dāng)?shù)據(jù)結(jié)構(gòu)

    這篇文章主要介紹了Lua學(xué)習(xí)筆記之?dāng)?shù)據(jù)結(jié)構(gòu),本文講解了數(shù)組、矩陣、鏈表、隊(duì)列等內(nèi)容,需要的朋友可以參考下
    2014-09-09
  • LUA string庫(kù)使用小結(jié)

    LUA string庫(kù)使用小結(jié)

    這篇文章主要介紹了LUA string庫(kù)使用小結(jié),本文總結(jié)了簡(jiǎn)單的模式串、格式化的模式串、模式串中的特殊字符、用'[]'創(chuàng)建字符集、在'[]'中使用連字符'-'等內(nèi)容,需要的朋友可以參考下
    2014-12-12
  • Lua基本語(yǔ)法

    Lua基本語(yǔ)法

    Lua是相當(dāng)簡(jiǎn)單易學(xué),本篇文章來(lái)給大家稍微講一下Lua的語(yǔ)法,不會(huì)長(zhǎng)篇累牘得把Lua的所有語(yǔ)法都講一遍,這里通過(guò)以下幾點(diǎn)來(lái)講Lua語(yǔ)言的基礎(chǔ)語(yǔ)法。
    2015-05-05
  • Lua table的concat方法使用實(shí)例

    Lua table的concat方法使用實(shí)例

    這篇文章主要介紹了Lua table的concat方法使用實(shí)例,本文講解了concat方法的用法及使用實(shí)例,需要的朋友可以參考下
    2015-04-04
  • Lua中讓回調(diào)函數(shù)支持回調(diào)對(duì)象方法的解決方法

    Lua中讓回調(diào)函數(shù)支持回調(diào)對(duì)象方法的解決方法

    這篇文章主要介紹了Lua中讓回調(diào)支持對(duì)象方法,一般情況下,Lua中只支持回調(diào)一個(gè)函數(shù),本文方法實(shí)現(xiàn)可以回調(diào)一個(gè)對(duì)象的方法,需要的朋友可以參考下
    2014-12-12
  • 最新評(píng)論

    宾阳县| 蛟河市| 商城县| 乌兰察布市| 斗六市| 友谊县| 临汾市| 马尔康县| 江川县| 龙南县| 崇文区| 盐亭县| 双桥区| 石渠县| 武宁县| 渭源县| 泾阳县| 扎赉特旗| 湛江市| 繁峙县| 姚安县| 特克斯县| 左贡县| 五原县| 青州市| 榕江县| 景谷| 个旧市| 泰兴市| 盐池县| 茂名市| 志丹县| 五峰| 博兴县| 辽阳市| 莱州市| 永州市| 云和县| 洪湖市| 东山县| 南澳县|