- Lua Quick Start Guide
- Gabor Szauer
- 108字
- 2021-08-05 10:30:36
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
推薦閱讀
- 零基礎學Scratch少兒編程:小學課本中的Scratch創意編程
- C# 從入門到項目實踐(超值版)
- 單片機應用技術
- 西門子S7-200 SMART PLC編程從入門到實踐
- C++語言程序設計
- Building Serverless Web Applications
- Android應用開發實戰
- Building Dynamics CRM 2015 Dashboards with Power BI
- HTML5移動前端開發基礎與實戰(微課版)
- Python全棧開發:基礎入門
- Spring Boot從入門到實戰
- JBoss AS 7 Development
- Java Script從入門到精通(第5版)
- Clojure High Performance Programming
- C#開發之道