VBScript
Scope of Variables
The scope of a variable dictates where it can be used within your script. The scope of a variable is determined by where it is declared. If the variable is declared within a procedure, it is referred to as a procedure-level variable and can only be used within that procedure. On the other hand, if it is declared outside of any procedure, it is a script-level variable and can be used throughout the script you have.
The example below demonstrates both script-level and procedure-level variables.
<script language="vbscript">
<!--
dim variable1
sub dosomething()
dim variable2
end sub
-->
lt;/script>
The variable called variable1 is a script-level variable and can be utilized throughout the script. The variable named variable2 exists only within the dosomething() sub-procedure.