bas7advr.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 and $DYNAMIC Metacommands Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
The $STATIC metacommand sets aside storage for arrays during compilation.
The $DYNAMIC metacommand sets aside storage from arrays while the program
is running.
 
REM $STATIC
    or
' $STATIC
 
REM $DYNAMIC
    or
' $DYNAMIC
 
Usage Notes
    ■ When the $STATIC metacommand is used, the ERASE statement
      reinitializes all array values to zero (numeric arrays) or the null
      string (string arrays) but does not remove the array.
    ■ $DYNAMIC allocates storage for arrays while the program is running.
      This means that the ERASE statement removes the array and frees
      the memory it took for other uses. You also can use the REDIM
      statement to change the size of an array allocated using $DYNAMIC.
    ■ The $STATIC and $DYNAMIC metacommands affect all arrays except
      implicitly dimensioned arrays (arrays not declared in a DIM
      statement). Implicitly dimensioned arrays are always allocated as
      if $STATIC had been used.
    ■ All arrays inside a SUB or FUNCTION procedure are dynamic unless the
      STATIC keyword is included in the SUB or FUNCTION statement.