QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The $DYNAMIC Metacommand allows the creation of dynamic (resizable) arrays.

Syntax

{REM } $DYNAMIC

Description

Example(s)

REDIMing a $DYNAMIC array using _PRESERVE to retain previous array values.


REM $DYNAMIC             'create dynamic arrays only
DIM array(10)            'create array with 11 elements
FOR i = 0 TO 10
  array(i) = i: PRINT array(i); 'set and display element values
NEXT
PRINT
REDIM _PRESERVE array(10 TO 20)
FOR i = 10 TO 20
  PRINT array(i);
NEXT
END 


0  1  2  3  4  5  6  7  8  9  10

0  1  2  3  4  5  6  7  8  9  10

See Also