OPTION REDIM

Previous  Next

 

OPTION REDIM ON/OFF

 


 

Enables or disables the DIM re-dimension feature.  When turned on, old data will be preserved when changing dimension of arrays using the DIM statement.

 

Technical Note

This will do a raw memory copy of existing array buffer to new buffer and may not necessarily copy contents as expected in a multi dimensional array.  When an array is expanded, the new memory locations will be filled with zeros (NULL).

 

Example:

 

OPTION BASE 1

DIM my_array(10) AS INTEGER

 

' Initialize array

FOR i = 1 TO 10

  my_array(i) = i

NEXT i

 

OPTION REDIM ON

DIM my_array(20) AS INTEGER

 

' Initialize expanded array

FOR i = 11 TO 20

  my_array(i) = i

NEXT i

 

END