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.
Automatic and Static Variables
  Data Types   Automatic and Static Variables   Contents   Index
──────────────────────────────────────────────────────────────────────────────
Automatic and Static Variables
 
BASIC procedures can use both automatic and static variables.
 
  ■ Automatic variables are initialized at the start of each call to the
    FUNCTION or SUB.
 
  ■ Static variables retain values between calls.
 
You can control whether the default is automatic or static by using or
omitting the STATIC keyword in the SUB or FUNCTION statement.
 
  ■ If you omit STATIC, then the default for variables is automatic.
 
  ■ When you use STATIC, the default for all variables in the procedure is
    static: the values of the variables are saved between procedure calls.
 
You can make selected variables in a procedure STATIC by making the default
automatic (omitting STATIC from the SUB or FUNCTION statement) and using
the STATIC statement.