◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── Declaring Dynamic Arrays ■ Dynamic arrays allow you to change the size of an array at run time. This type of array can be declared by: • Using the $DYNAMIC metacommand before declaring the array: REM $DYNAMIC DIM [SHARED] MyArray(1 TO 100) AS STRING * 16 • Declaring the array with a variable or expression: X = 100 DIM [SHARED] MyArray(X) AS STRING * 16 • Declaring the array after it is declared in a COMMON statement: COMMON [SHARED] MyArray() AS STRING * 16 DIM MyArray(1 TO 100) AS STRING * 16 • Using the REDIM statement REDIM [SHARED] X(1,2) AS INTEGER • Using DIM within a SUB procedure; this always creates a dynamic array: SUB ChangeText () DIM MyArray(1 TO 100) AS STRING * 16 ... END SUB See: ◄COMMON Statement► ◄$DYNAMIC Metacommand► ◄DIM Statement► ◄REDIM Statement► ◄Scope Rules► ◄SHARED Statement► ◄$STATIC Metacommand► ◄Static and Dynamic Arrays► ◄STATIC Statement►