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

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
主站蜘蛛池模板: 四子王旗| 麟游县| 宁夏| 四会市| 望谟县| 三台县| 安顺市| 大渡口区| 都江堰市| 陆河县| 阳高县| 安康市| 临沂市| 萝北县| 台北市| 松阳县| 梅州市| 乌恰县| 苍溪县| 文安县| 惠来县| 西丰县| 夹江县| 克东县| 休宁县| 新源县| 绥化市| 长武县| 邓州市| 通化市| 临澧县| 汽车| 静乐县| 乌兰浩特市| 日照市| 龙井市| 安阳县| 九龙城区| 达州市| 宁蒗| 仁布县|