PRINT "The days are ", DAY$( 1 ), DAY$(2 ), DAY$( 3 ), DAY$( 4 ) PRINT DAY$( 5 ), DAY$( 6 ), " and " DAY$(7 )
The program does not do anything practical.
It is just an example of how arrays work.
Here is another not-very-practical program:
Say that you have an important date this week,
and want the program to print out what day it is on.
The following program uses the string variable
HOTDATE$
to hold the name of the important day.
That name will be copied from one of the array slots:
DIM DAY$(1 TO 7) ' Make an array of seven strings LET DAY$(1) = "Monday" ' Make "Monday" the first item LET DAY$(2) = "Tuesday" LET DAY$(3) = "Wednesday" LET DAY$(4) = "Thursday" LET DAY$(5) = "Friday" LET DAY$(6) = "Saturday" LET DAY$(7) = "Sunday" LET HOTDATE$ = DAY$(5) ' Copy the fifth DAY$ into HOTDATE$ PRINT "Important date on:", HOTDATE$ END
What does the above program write out?