Yorick Reference Card

Web Home
Getting Started
Manual
Quick Reference
Language Reference
Function Reference
I/O Reference

Language Reference Starting and Quitting Yorick Getting Help Error Recovery Array Data Types Constants Defining Variables Arithmetic and Comparison Operators Logical Operators Creating Arrays Indexing Arrays Array Conformability Rules Calling Functions Defining Functions Variable Scope Returning from Functions Compound Statements Conditional Execution Loops Function Reference I/O 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.