yorick banner




Global Index


Quick Reference

Yorick Language Reference

Variable Scope

local var1, var2, ..., varN give the varI local scope
extern var1, var2, ..., varN give the varI external scope

If a variable var has local scope within a function, any value associated with var is temporarily replaced by nil on entry to the function. On return from the function, the external value of var is restored, and the local value is discarded.

If a variable var has external scope within a function, references to var within the function refer to the var in the ``nearest'' calling function for which var has local scope (that is, to the most recently created var).

The *main* function has no variables of local scope; all variables created at this outermost level persist until they are explicitly undefined or redefined.

Dummy or keyword arguments always have local scope.

In the absence of a extern or local declaration, a variable var has local scope if, and only if, its first use within the function is as the left operand of a redefinition, var =expr.