ArraySize()

Syntax

Result = ArraySize(Array() [, Dimension])
Description
Returns the size of the array, as specified with Dim or ReDim.

Parameters

Array() The array to get the size from.
Dimension (optional) For multidimensional arrays, this parameter can be specified to get a specific dimension size. The first dimension starts from 1.

Return value

Returns the size of the array dimension. If the array isn't yet declared (or its allocation has failed), it will return -1.

Example

  Dim MyArray(10)
  Debug ArraySize(MyArray()) ; will print '10'

  Dim MultiArray(10, 20, 30)
  Debug ArraySize(MultiArray(), 2) ; will print '20'

Example

  Dim Test.q(99999999999999999)
  
  If ArraySize(Test()) <> -1
    Test(12345) = 123  ; everything fine
  Else
    Debug "Array 'Test()' couldn't be initialized."
  EndIf

See Also

ListSize(), MapSize()

Supported OS

All

Array Index - CopyArray() ->