redim

Resizes the array of a user variable. (version 5.8.0 or later)
redim <array> <size> ['Preserve']

Parameters

Array <array>
Integer array or String array.
Integer <size>
Array size (1-65536).
String 'Preserve'
Optional. If omitted, existing data is initialized.
Specifying 'Preserve' changes the array size while preserving existing data.
If the specified array size is smaller than the original size, the elements in the truncated portion are removed.

Return Value

None.

Remarks

Changes the size of an Integer array or a String array.
Cannot be used with system variables or unused variables.

Example

strdim strarray 1                 ; Array declaration is required.

for size 1 65536
  redim strarray size 'Preserve'  ; Resize the array while preserving existing data.
  index = size - 1
  sprintf2 title 'element : %d' index
  inputbox 'Input finished without data.' title
  strcompare inputstr ''
  if result = 0 then
    goto show_listbox
  endif
  strarray[index] = inputstr
next

:show_listbox
listbox 'Input data' 'strarray' strarray

See also