Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the scope rules for Warehouse variables ?

rules SCOPE variables warehouse
0
Posted

What are the scope rules for Warehouse variables ?

0

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

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123