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 - Description
◄Scope Rules► ◄Variables► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Scope Rules - Description
Any time a variable appears in program text, BASIC follows a set of rules
to determine which object is referred to by the variable. These rules
describe a variable's scope--the range of statements over which the
variable is defined.
You may think of variables and constants as having one of two scopes: global
or local.
■ Global variables, once declared, may be used anywhere in a module
to refer to some single object.
■ Local variables are local to some part of the module (that is, the
module-level code or one of the procedures).
In addition, variables can be shared in such a way that they aren't quite
global nor are they completely local. This is done by using the SHARED
statement.