EasyManua.ls Logo

Radio Shack TRS-80 Model III - Page 111

Radio Shack TRS-80 Model III
274 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BASIC
You may use each
of these elements to
store a separate data
item, such as:
A(0)
=
5.3
A(1)
=
7.2
A(2)
=
8.3
A(3)
=
6.8
A(4)
=
3.7
In this example, array A
is a
one-dimensional array,
since each element contains
only one subscript. An array
may also be
two-dimensional,
with
each element
containing two subscripts.
For example, a
two-dimensional array named X could
contain these elements:
X(0,0)
=
8.6
X(0,1)
=
3.5
X(1,0)
=
7.3
X(1,1)
=
32.6
With BASIC, you may have
as many
dimensions in your array
as you would like.
Here is an example of a
three-dimensional
array named L which
contains
these 8
elements:
L(0,0,0)
=
35233 L(0,1
,0)
=
96522
L(0,0,
1
)
=
52000 L(0,
1
,
1
)
=
1 0255
L(1
,0,0)
=
33333
L(1
,1 ,0)
=
96253
L(1,0,1)
=
53853
L(1,
1,1)
=
79654
BASIC assumes that
all arrays contain 1 1
elements in each
dimension.
If
you want
more elements you must u se
the DIM
statement at the beginning of your program to
dimension the array.
For example, to
dimension array L, put
this line
at
the beginning of the program:
DIML(1,1,1)
to allow room for two elements
in the first
dimension; two in the second; and two in
the third
for a total of 2*2*2
=
8
elements.
See
the Arrays chapter
later on in this
manual.
101

Other manuals for Radio Shack TRS-80 Model III

Related product manuals