RDNWiki: DOWScar/Functions/nil ...

RDN Wiki Home | Page Index | Recent Changes | Recently Commented | Users | Registration | Login:  Password:  

nil Data Type


Contents


nil is “no value”. This can be used to delete a variable, and can be returned from a function whenever invalid data is present.


Also see the LUA documentation on nil for more information.

Example Code

-- Examples from http://lua-users.org/wiki/LuaTypesTutorial

	-- By setting a variable to nil you can delete a variable. e.g.

	local x = 2.5
	print(x)
	-- 2.5
	x = nil
	print(x)
	-- nil

	-- You can test to see if a variable exists by checking whether its value is nil.

	print(x == nil)
	-- true
	x = 7
	print(x == nil)
	-- false
	print(x)
	-- 7

Links


Data Types
Functions
SCAR Home
Wiki Home

End of Page

There are no files on this page. [Display files/form]
There is no comment on this page. [Display comments/form]