qb45advr.hlp (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.
STATIC Statement Details
  QuickSCREEN      Details      Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
STATIC Statement Details
 
Syntax
  STATIC variablelist
 
A STATIC statement variablelist has the following syntax:
 
  variable[()] [AS type] [,variable[( )][AS type]]...
 
The variablelist takes the following arguments:
 
  Argument   Description
  variable   Either a variable name or an array name.
  AS type    Declares the type of variable. The type argument can be
             INTEGER, LONG, SINGLE, DOUBLE, STRING, or a user-defined
             type.
 
The STATIC statement can appear only in a SUB, FUNCTION, or DEF FN function.
 
Earlier versions of BASIC required the number of dimensions in parentheses
after an array name. In QuickBASIC, the number of dimensions is optional.
 
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.
 
Usually, variables used in DEF FN functions are global to the module;
however, you can use the STATIC statement inside a DEF FN statement to
declare a variable as local to only that function.
 
  Note: The STATIC attribute on SUB and FUNCTION statements declares
        the default for variables to be STATIC. Variables having the
        same name as variables shared by the module-level code are
        still shared. In contrast, the STATIC statement makes specific
        variables STATIC and overrides any variables shared by the
        module-level code. The $STATIC metacommand affects how memory
        is allocated for arrays.