Example - UBound Function

  1. ' This example demonstrates some of the features of arrays. The lower bound

    ' for an array is 0 unless it is specified or option base is set it as is

    ' done in this example.

     

    Option Base 1

     

    Sub Main

    1. Dim a(10) As Double

      MsgBox "LBound: " & LBound(a) & " UBound: " & UBound(a)

      Dim i As Integer

      For i = 1 to 3

      1. a(i) = 2 + i

      Next i

      Print a(1),a(1),a(2), a(3)

    End Sub