What are the scope rules for Warehouse variables ?
All variables are considered global to a script unless defined within a function. If a variable is defined within a function, it is considered local to its defining function. Global variables are persistent and can be accessed from anywhere in the script. A function variable is local to its defining function and as such cannot be accessed from outside of that function. A function variable is an automatic variable : it is created upon entry to the function and destroyed upon exit. If a global variable and a function variable share the same name then any use of that shared name outside the defining function will reference the global variable. Any use of that shared name inside the defining function will reference the local function variable. The following code demonstrates these scope rules, where the variables i and j are variously defined as both global and local variables : 1> define i : integer 2> define j : integer 3> 4> function func2 5> define j : integer 6> setvar j = 219 7> prin