EasyManua.ls Logo

Texas Instruments TI-99/4A - Page 130

Texas Instruments TI-99/4A
204 pages
Print Icon
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...
DIMension
DIM
1array-name
(in
tegerll.in
teger21
l.integerJ
I)
I...
The
DIMension
statement
reserves
space
for both numeric and
string
arrays, You
can
explicitly dimension
an
array
only
once
in
your
program.
If
you
dimension
an
array.
the
DIM
statement
must
appear
m the
program
before any
other
reference to
the
array.
If
you dimension more
than
one
array
in a single DIM
statement.
the
array
names
must
be
separated
by Commas.
The
array-name may
be any valid variable name.
You
may
use one-two,
or
three-dimensional
arrays
in
TI
BASTC.
The
numbCl'
of
valucs
in
pal'cntheses
followlllg
the
array
name
tells
the
computer
how
many
dimensions the
array
has.
One-dimensional
arrays
have only
one
integ-er value following- their
name. Two-dimensional
arrays
are
described
with two
integer
values which define
the
number
of
rows
and
columns.
Three-
dimensional
arrays
have
three
integer values defining their
characteristics.
DIM A(6) - describes a one-dimensional array.
DIM
A(12.3)
-
describes
a
tvvO'dimcnsional
array.
DIM A(S,2,11) - describes a three-dimensional array.
If
an
array
is not dimensioned in a
DIM
statement.
the
computer
will automatically
assign
a value of
10
for
integer! (and a value of
10 for integer:)
and
integer3
if
needed)
for
each
array
used.
Space
is allocated for your
array
after you
enter
the
RUN
command
but
before the program is actually run.
Each
element in a
string
array. however. is a null
string
until you actually
place
values in
each
element
If
your
computer
memory
cannot
handle an
array
with
the
dimensions you specified. you will get a
"MEMORY
FULL"
message
and
your
program
will
not
run.
II-liD
Examples:
>DIM
A(12),SCS)
>NEW
>100
DIM
X(1S)
>110
FOR
1=1
TO
1S
>120
READ
XCI)
>130
NEXT
1
>140
REM
PRINT
LOOP
>150
FOR
1=15
TO
1
STEP
-1
>160
PRINT
XC!);
>170
NEXT
1
>180
DATA
1,2,3,4,5,6,7,8,9,1
0,11,12,13,14,15
>190
END
>RU
N
15 14 13 12
11
10 9
876
5
432
1
**
DONE
**
User's
Reference
Guide

Other manuals for Texas Instruments TI-99/4A

Related product manuals