'For OPTIMAL speed performance (maybe not optimal memory storage):
' A Static array would likely be best choice:
' 1. Use a top limit variable to control the absolute maximum size you would allow program to go.
' 2. Use a top index variable to track the current "upper" bound of your array.
topLimit = 10 '<<< absolute maximum number of elements you would allow
topIndex = 0 ' <<< current "upper" bound of the array, the number of items that are actually assigned values by program.
DIM myStaticArr
(1 TO topLimit
) '<<<< this assigns the maximum size you would allow the array to go IM THE BEGINNING.
FOR addItem
= 1 TO topLimit
item = addItem ^ 2
topIndex = topIndex + 1
myStaticArr(topIndex) = item
PRINT "For Top index ="; topIndex;
" The array contains:" INPUT "Continue show? Just press Enter for yes, any other entered quits > "; cont$
PRINT "We've reached the preset Top Limit for the Static Array."