User:Anaminus/local nutshell

From Legacy Roblox Wiki
Revision as of 07:05, 6 April 2008 by >Anaminus ('local' in a nutshell)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

'local' in a nutshell...

local: Makes a variable inside a block of code exist only inside that block of code.

(Just like variable 'g' in one script wont exist in another)

Example:

g = "global" 

if true then 
local l = "local" 
end 

print(g) 
print(l)

'global' will appear in the output.

'nil' will appear in the output.

Another Example:

g = "global" 
local l = "local" 
if true then 

end 

print(g) 
print(l)

'global' will appear in the output.

'local' will appear in the output.