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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.218.157