bas7qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Scope Rules
  Variables                                    Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Scope Rules
 
The following list summarizes BASIC's scope rules for variables and
constants:
 
  ■ A variable is a global variable if it is declared in a DIM, REDIM,
    or COMMON statement with the SHARED attribute. Any SUB or FUNCTION
    procedure within the module can refer to the variable.
 
  ■ A symbolic constant is global if it is declared in a CONST statement in
    the module-level code. Symbolic constants declared in a SUB or FUNCTION
    are local.
 
  ■ A variable is a local variable if it appears in a procedure and is not
    declared as a global variable. You can use the name of a global
    variable as a local variable in a procedure by declaring it in the
    procedure with the STATIC statement or by using it as a formal parameter.
 
  ■ The SHARED statement lets you share a variable with the module-level
    code and other procedures with equivalent SHARED statements without
    making the variable a global variable.
 
  ■ All variables in a DEF FN function are part of the module-level code
    unless they are explicitly made local in a STATIC statement or are
    formal parameters.
 
See Also    Global Variables and Constants
            Local Variables and Constants
            Scope Rules - Description
            Sharing Variables
            DEF FN Functions