' array index redim example, by frank bruebach
' halProment Basic, dec. 2018, may 2024
'
indexbase 1

DIM MyArray(10) AS INTEGER '1 TO 10
DIM i AS INTEGER

' Fill the array with some values
FOR i = LBOUND(MyArray) TO UBOUND(MyArray)
    MyArray(i) = i * 10
NEXT i

' Display the values in the array
FOR i = LBOUND(MyArray) TO UBOUND(MyArray)
    print "MyArray(" + STR(i) + ") = " + STR(MyArray(i))
NEXT i

' Re-dimension the array to have 15 elements
REDIM integer MyArray(15) '1 to 15


' Fill the new array elements with some values
FOR i = UBOUND(MyArray) - 4 TO UBOUND(MyArray)
    MyArray(i) = i * 5
NEXT i

' Display the values in the re-dimensioned array
FOR i = LBOUND(MyArray) TO UBOUND(MyArray)
    print "MyArray(" + STR(i) + ") = " + STR(MyArray(i))
NEXT i


