Determining Variable Scope

You can write code that shares a variable across modules. The following locations where you declare a variable determines the scope of the variable:

  • Declare in a procedure. The variable is local to this procedure.

  • Declare outside a procedure. The variable is local to the module.

If you declare a variable that has the same name as a module variable, then you cannot access the module variable. For more information, see Declare Global Variable Statement.