ArraySize()

语法

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

参数

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.

返回值

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

示例

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

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

示例

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

参阅

ListSize(), MapSize()

已支持操作系统

所有

Array Index - CopyArray() ->