Referencing Environments and Scope
What are different types of Referencing Environments, Type Parameters and Parameterized Types
Referencing Environments and Scope
Every subprogram has a set of identifiers that it can use during its execution. A local referencing environment is one where the set of association and identifiers are made upon entry to the subprogram. A non local referencing environment is one where identifiers can be used in a subprogram but are not created upon entry into it. A global referencing environment is one where the identifiers are made upon entry into the main program. All global references are non local references but not all non local references are global references. In a predefined referencing environment, associations are already made directly in the programming language. They can be used in the subprogram without explicitly declaring them.
The scope of a program variable is the range of statements where it is visible. The visibility of a variable is its existence in a particular referencing environment. When variables are determined prior to execution, they are said to have a static scope. When variables are determined at run time then they are said to have a dynamic scope.
Type Parameters and Parameterized Types
Parameters have to be specified within the scope or they have to be declared implicitly. For example, if you do not specify the parameters for local variables then you have to make sure that the parameters for the variables were declared implicitly. Otherwise, the program will fail to run.
In your Visual Basic Editor, try making some global variables. You can use these variables throughout the entire module. You do not have to declare them every time you start a subprogram, a function, or whatever programming script you need to execute. At the very beginning of the module, set some variables like the ones illustrated below.