' BOUNDS.BAS
' This program loads data into an array until QUIT is typed or
'   the array boundaries are exceeded.

OPTION BASE 1               ' set array base to 1
DIM party$(5)               ' dimension array with 5 elements

count% = 1                  ' initialize loop counter to 1
          
CLS                         ' display intro message and QUIT note
PRINT "Enter party game ideas; type QUIT to stop"
PRINT
                            ' loop while count% is within array bounds
DO WHILE (count% >= LBOUND(party$)) AND (count% <= UBOUND(party$))
    INPUT "Party game:  ", party$(count%)      ' read input into array
    IF (party$(count%) = "QUIT") THEN EXIT DO  ' if user types QUIT,
    count% = count% + 1                        '   then exit loop
LOOP

PRINT
PRINT "You entered the following games:"
PRINT

FOR i% = 1 TO count% - 1    ' print array contents
    PRINT party$(i%)        ' count% - 1 contains last value entered
NEXT i%

