官术网_书友最值得收藏!

  • Lua Quick Start Guide
  • Gabor Szauer
  • 101字
  • 2021-08-05 10:30:37

Boolean

A boolean variable can have one of two values: true or false. Booleans are often used to control the flow of code and express logic. This code assigns the Boolean value of true to the variable foo, then prints this value:

foo = true
print ("The value of foo is:")
print (foo)

A more useful example of a Boolean is to obtain it from some kind of logical operation, for example, to check whether five is greater than three or not. This code demonstrates how to do this:

result = 5 > 3
print ("Is 5 > 3?")
print (result)
主站蜘蛛池模板: 伽师县| 新民市| 湖北省| 墨江| 汉阴县| 广安市| 丰都县| 五家渠市| 天峨县| 馆陶县| 丘北县| 抚远县| 信丰县| 牡丹江市| 泾川县| 福鼎市| 无为县| 开平市| 洮南市| 鄢陵县| 京山县| 新竹市| 友谊县| 三台县| 黄冈市| 高雄县| 图木舒克市| 兴业县| 永州市| 南宫市| 肃南| 岑溪市| 东兰县| 咸宁市| 金堂县| 古浪县| 台安县| 冷水江市| 牡丹江市| 太仓市| 博爱县|