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.
STATIC Statement Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
STATIC variable[()] [AS type] [,variable[()] [AS type]]...
Usage Notes
■ Variables declared in a STATIC statement override variables of the same
name shared by DIM or COMMON statements in the module-level code.
Variables in a STATIC statement also override global constants of the
same name. See: ◄COMMON Statement► ◄DIM Statement►
■ Usually, variables used in DEF FN statements are global to the module;
however, you can use the STATIC statement inside a DEF FN function to
declare a variable as local to only that function.
■ The STATIC statement can appear only in a SUB or FUNCTION procedure or a
DEF FN statement.
See: ◄DEF FN Statement► ◄FUNCTION Statement► ◄SUB Statement►
■ The STATIC statement, the STATIC keyword, and the $STATIC metacommand
are all used to affect variables and arrays, but differ in the following
ways:
Usage Description
═══════════════════════ ════════════════════════════════════════════
STATIC attribute in SUB Declares the default for variables as static;
and FUNCTION statements variables having the same name as variables
shared by module-level code are still shared
STATIC statement Makes specific variables static; overrides
any variables shared by module-level code
$STATIC metacommand Affects how memory is allocated for arrays
See: ◄STATIC Keyword► ◄$STATIC Metacommand►