EasyManua.ls Logo

Atari 800

Atari 800
326 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...
66
User's
Handbook
to
the
Atari
400/ 800
Computers
100 PRINT "ENTER YOUR AGE";
200 INPUT AGE
In
the
preceding
example,
the
prompt,
"ENTER
YOUR
AGE",
will
appear
on
the
same line
as
the
INPUT
prompt.
Loops
Suppose that
you
ne
eded
to
compute
the
squares
of
the
integers
from
1
to
20.
One
way
of
doing
this
is
by calcul
ating
the square
for
each
individual
int
eger
as
s
hown
below.
100 A = 1
"2
200 PRINT A
300 B = 2
"2
400 PRINT B
500 C = 3
"2
600 PRINT C
However
, this m
ethod
is very
cumbersome.
This
problem
could
be
solved
mu
ch
more
effic
i
ent
ly
through
the
u
se
of
a
FOR, NEXT
loop
as
show
n
below.
100 FOR A = 1
TO
20
200 X = A
"2
300 PRINT X
400
NEXT
A
500 END
The
sequence
of
statements
from
100 to 400 is
known
as
a loop.
When
the
computer
encounters
the FOR
statement
in
lin
e 100,
the
variable A
is
set
to
1. X is
then
calc
ul
ated and displayed in
lines 200 and 30
0.
The
NEXT
statement
in
lin
e 400
will
request the next value
for
A.
Execution
returns
to
line 100
where
the
value
of
A is in
creme
nt
ed
by
1
(to
2)
and
then
compa
red to the value
appearing
afte
r TO.
Since
the
value
of
A is l
ess
than that value,
the
l
oop
will
be
executed
again
with
the
va
lue
of
A set
at
2.

Other manuals for Atari 800

Related product manuals