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

  • Lua Quick Start Guide
  • Gabor Szauer
  • 104字
  • 2021-08-05 10:30:36

Assigning variables

Since a variable is just a description of the underlying data, the data can change. For example, if you have a variable named time, you would expect its value to change every second. At any point, you can use the assignment operator = to assign a new value to a variable.

This code snippet explores this by creating a single variable, color, and assigning it three different values. The value of color is printed after each assignment:

color = "red"
print (color)
color = "green"
print (color)
color = "blue"
print (color)

The output from this program should look like this:

主站蜘蛛池模板: 瑞昌市| 星座| 绵阳市| 会东县| 惠东县| 沐川县| 曲水县| 黄大仙区| 武义县| 友谊县| 铜鼓县| 工布江达县| 兴安县| 阿图什市| 永宁县| 托里县| 通州区| 松原市| 文安县| 丹江口市| 新密市| 定陶县| 浦城县| 老河口市| 宝清县| 华坪县| 揭阳市| 二手房| 吉安市| 耿马| 七台河市| 毕节市| 桃园县| 江山市| 合阳县| 延长县| 漳平市| 南宁市| 南溪县| 淳化县| 邯郸市|