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

nil

A nil value represents the absence of data. If you try to access a variable that has not been created yet, its value will be nil. If you are done using a variable, you should assign it to be nil. This code first prints nil because nothing is assigned to the variable foo. Then, the string bar is assigned, and after this the code prints bar. Finally, nil is assigned back to the variable. The last time the variable is printed, it will print nil again:

print (foo) -- will print: nil
foo = "bar"
print (foo) -- will print: bar
foo = nil
print (foo) -- will print: nil
主站蜘蛛池模板: 嘉义县| 长寿区| 阿坝| 资溪县| 罗源县| 长春市| 牙克石市| 贡山| 灌阳县| 英吉沙县| 大足县| 上高县| 安顺市| 肥城市| 微博| 资中县| 资溪县| 韶山市| 鄂托克前旗| 阿城市| 旬阳县| 宿松县| 沐川县| 固安县| 杭锦旗| 武隆县| 高要市| 开鲁县| 宁德市| 措美县| 廊坊市| 高碑店市| 淳安县| 彝良县| 大厂| 凤阳县| 花垣县| 湄潭县| 夹江县| 黄龙县| 亚东县|