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

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

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

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

201552893006602.jpg (626×426)

示例

試試下面的例子就明白了所有的Lua編程語言提供的關(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í)行上面的程序它會產(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并沒有集成Lua解釋器,但安裝起來依然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ù)組、矩陣、鏈表、隊列等內(nèi)容,需要的朋友可以參考下
    2014-09-09
  • LUA string庫使用小結(jié)

    LUA string庫使用小結(jié)

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

    Lua基本語法

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

    Lua table的concat方法使用實例

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

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

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

    东乡| 祁东县| 赣榆县| 耒阳市| 华坪县| 清新县| 拜泉县| 宝兴县| 四川省| 铁岭县| 磐安县| 合山市| 乐至县| 开阳县| 泰州市| 平度市| 平阳县| 克东县| 铁岭县| 湟源县| 镇坪县| 从江县| 武威市| 宝坻区| 奉新县| 科技| 鄱阳县| 曲周县| 陆川县| 林周县| 湖南省| 同德县| 博客| 江津市| 孙吴县| 刚察县| 昌乐县| 忻城县| 象州县| 岳池县| 班玛县|