LET VALUE(4) = VALUE(1) ' Copy the number in the first slot to the fourth slot
The number in VALUE(1)
(which is 19.234) is copied
into VALUE(4)
.
This is nearly the same thing as what happens with ordinary variables:
LET SINK = SOURCE ' Copy the number in SOURCE to the variable SINK
except that now subscripts are used to describe the both the value and where it goes.
Also, just as with ordinary variables, you can change what is in a subscripted variable as many times as you want. Look at this program:
DIM VALUE(1 TO 5) ' Ask for an array of floating point numbers ' LET VALUE(1) = 19.234 ' Put 19.234 into the first slot of the array LET VALUE(2) = -12.6 ' Put -12.6 into the second slot LET VALUE(3) = 99.85 ' Put 99.85 into the third slot LET VALUE(1) = __________ ' Change the value in the first slot to -20.08 LET VALUE(2) = __________ ' Make the contents of slot 2 the same as slot 3 PRINT "First slot:", VALUE(1) ' Print out the first slot PRINT "2nd slot:", VALUE(2) ' Print out the second slot PRINT "3rd slot:", VALUE(3) ' Print out the third slot END
Fill in the blanks so that the statements agree with their comments.