ReDim

Gives an array new sizes, keeping what fits

Keywords

Parameters & Returns

Parameters

This function takes no parameters.

Returns

Void

Quick Summary

Gives an array new sizes, keeping what fits

Technical Exegesis...

Gives an array new sizes while the program runs. Syntax is ReDim name[size1][size2]..., with one size for each of the array's dimensions. What fits in the new sizes is kept; the new cells are 0, "" for Strings and Null for Types. The sizes can be any expression, so ReDim list[ArrayLength(list) + 1] makes room for one more.

Works on Local and Global arrays (not yet on Fields, Consts or parameters). An array used with ReDim can't be given starting values when it's declared.

Example

Example.bam
Local map:Int[3][2]
map[2][1] = 7
ReDim map[5][4]
Print ToString(map[2][1])          ; 7: kept
Print ToString(ArrayLength(map, 0))   ; 5