ArrayLength

Returns the size of one of an array's dimensions

Keywords

Parameters & Returns

Parameters

array Array
dimension Int

Returns

Int

Quick Summary

Returns the size of one of an array's dimensions

Technical Exegesis...

Returns the size of one of an array's dimensions. Syntax is ArrayLength(array, dimension), counting from 0: ArrayLength(map, 0) is the first dimension and ArrayLength(map, 1) the second. For a 1D array, ArrayLength(array) on its own is the same as ArrayLength(array, 0). A dimension the array doesn't have (below 0, or past its last one) gives -1, so it can't be mistaken for a dimension of size 0.

It follows the array's sizes as they change with ReDim and EraseDim.

Example

Example.bam
Local map:Int[40][25]
For x:Int = 0 To ArrayLength(map, 0) - 1
    For y:Int = 0 To ArrayLength(map, 1) - 1
        map[x][y] = 1
    Next
Next