Site Tools

Determine of a Dynamic Array has been Dimensioned

Developer: RhinoScript
Summary: Demonstrates how to determine of a dynamic array has been dimensioned.


How can I determine whether or not a dynamic array has been dimensioned?


See the example code below.

 ' Returns a Boolean value indicating whether an
 ' array has been dimensioned - determine
 ' whether or not the array has an upper bound.
 Function IsUpperBound(ByVal arr)
   IsUpperBound = False
   If IsArray(arr) Then
     On Error Resume Next
     UBound arr
     If Err.Number = 0 Then IsUpperBound = True
   End If
 End Function
developer/scriptsamples/isupperbound.txt ยท Last modified: 2020/08/14 (external edit)