Return the largest subscript for an array dimension.

      UBound(arrayname[, dimension])

   arrayname    The name of the array variable

   dimension    The array dimension as a whole number
                1 for the first dimension, 2 for the second etc

The UBound function is used with the LBound Function to determine the size of an array. Use LBound to find the lower limit of an array dimension.


Dim Arr(5,10,12)
result = UBound(Arr, 1)
WScript.Echo result

“Who looks outside, dreams; who looks inside, awakes” - Carl Gustav Jung


Array(el1,el2,el3) - Add values to an Array variable
Dim - Declare a new variable or array variable
LBound - Return the smallest subscript for an array.
Equivalent in PowerShell: $arrDemo.getupperbound(0) or $arrDemo.length-1

Copyright © SS64.com 1999-2019
Some rights reserved