ArraySize()

Syntax

Result = ArraySize(Array() [, Dimension])
Description
Returns the size of the array, as specified with Dim or ReDim. For multi-dimensional arrays, 'Dimension' can be specified to get a specific dimension size. The first dimension starts from 1. If the array isn't yet declared (or its allocation has failed), it will return -1.

Example:

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

  Dim MultiArray.l(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

Supported OS

All

Array Index - CopyArray() ->