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

  • 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)
主站蜘蛛池模板: 阳东县| 和硕县| 天津市| 苏尼特右旗| 盖州市| 连南| 丰顺县| 漯河市| 依兰县| 银川市| 北票市| 佛坪县| 逊克县| 陇南市| 建宁县| 阿克苏市| 禄丰县| 抚顺市| 尼木县| 静乐县| 文昌市| 交口县| 太谷县| 沙河市| 吕梁市| 桑日县| 浦北县| 饶平县| 常德市| 景泰县| 高平市| 迁安市| 佛学| 赤城县| 波密县| 宁陵县| 新野县| 娱乐| 山西省| 丁青县| 巴林左旗|