From Xojo Documentation
Resizes the specified array. Arrays are zero-based.
Redim arrayName (newSize1[,newSize2,...newSizeN])
|arrayName||n/a||The name of any previously declared array.|
|newSize1||Integer||The new size for the array. Use -1 to create an unbounded array, which removes all the array elements. Resizing the array to less than -1 causes an OutofBounds exception.
In the case of multi-dimensional arrays, this is the new size for the first dimension of the array.
|newSizeN||Integer||The new size for the Nth dimension of the array.
You must pass as many newSize parameters as there are dimensions in the array.
The Redim method is used to increase or reduce the number of elements in the array specified. Arrays are zero-based (the first element is zero) so you resize the array using a number that is one less than the number of elements you actually want. The number of parameters passed is the number of dimensions of the array being resized.
When you Redim an array with no bounds (-1) then all its elements are removed. It is faster to Redim an array in this manner than to loop through the array and individually remove each value. You can use the array Append or Insert methods to add elements or you can Redim it again to the exact size you need.
When you Redim an array to increase its size, any existing values in the array are retained.
When you Redim an array to decrease its size, existing values are retained if they are still within the new array bounds.
This example reduces the aNames array to 11 elements.
This example adds 10 elements to the aNames array
This example reduces the aPeople array to 11 elements for the first dimension and 6 elements for the second dimension
When you Redim an array with no bounds, its elements are removed. This is a fast way to clear out an array:
Dim statement; Array, Join, Split, Ubound functions; Append, IndexOf, Insert, Pop, Remove, Shuffle, Sort, Sortwith methods; ParamArray keyword; Operator_Redim, Operator_Subscript functions; Arrays concept