User:Anaminus/local nutshell

From Legacy Roblox Wiki
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.