113 INPUT "HOW MANYROLLS': II.:X
213 FOR L
= 1 TO X
313 R = INT<6*RND(1ยป+1
413 IF R
= 1 THEN F1 = F1
41 IF R
= 2 THEN F2 = F2
42 IF R
= 3 THEN F3 = F3
43 IF R
= 4 THEN F4 = F4
44 IF R
= 5 THEN F5 = F5
45 IF R
=6 THEN F6 = F6
613 PRINT "FACE", "NUMBER
713 PRINT 1, F1
71 PRINT 2, F2
72 PRINT 3, F3
73 PRINT 4, F4
74 PRINT 5, F5
75 PRINT 6, F6
+ 1 : NEXT
+ 1 : NEXT
+ 1 : NEXT
+ 1 : NEXT
+ 1 : NEXT
+ 1 : HEXT
OF TIMES"
The program has doubled in size from 8 to 16 lines. In larger pro-
grams the space savings from usirrg subscripted variables will be even
more dramatic. .
TWO-DIMENSIONAL ARRAYS
Earlier in this chapter you experimented with one-dimensional arrays.
This type of array was visualized as a group of consecutive boxes within
memory each holding an element of the array. What would you expect
a two-dimensional array to look like?
First, a two-dimensional array would be written like this:
A(4,6)
r t!scRIPTS
ARRAY NAME
and could be represented as a two-dimensional grid within memory:
~
1
2
3
4
The subscripts could be thought of as representing the row and col-
umn within the table where the particular element of the array is stored.
100