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

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
主站蜘蛛池模板: 大关县| 乐至县| 定西市| 日喀则市| 九龙城区| 十堰市| 营口市| 太白县| 潼关县| 通榆县| 米泉市| 信宜市| 呼图壁县| 郯城县| 酒泉市| 连平县| 油尖旺区| 平乐县| 金塔县| 达拉特旗| 阳朔县| 钟山县| 鄂托克前旗| 金阳县| 沈阳市| 张北县| 无为县| 湾仔区| 上蔡县| 朝阳区| 祁东县| 廊坊市| 内江市| 内丘县| 南漳县| 达尔| 怀集县| 舟曲县| 阿拉善左旗| 资源县| 文昌市|