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...
Intr
oduction
to
Atar
i BASIC
67
The
loop
will
continue
to
be executed
until
r\ atta ins a value
greater than
20
.
When
this occu
rs
, the state
ment
following
the
NEXT
statement
will
be executed.
In
our
preceding
example, A
is
known
as
an
index
variable.
If
the
optional
keyword
STEP
is
not
inc
luded
w
ith
the
FOR statement,
the
inde
x variable
will
be
incr
emented
by 1
every
time
the
NEXT
statement
is
executed.
STEP
can be
included
at
the end
of
a
FOR
stateme
nt
to
change
the value by
which
th e
inde
x variable
is
incr
eme
nted
. The
integer
appearing after
STEP
is
the
new
increment. For example,
if
our
preceding
exa
mple
were changed
as
follows
,
100
FOR A = 1
TO
20
STEP
2
200
X = A A 2
300
PRINT X
400
NEXT
A
500
END
the
inde
x variable A
would
be
increment
ed by 2 every
time
the
NEXT
stateme
nt
was
executed.
Nested Loops
One
loop
can be placed inside
of
another
loop
. The
innermost
loop
is
known
as
a nested loop. The
following
program
contains
a nested
loop
.
100
P =
1000
200
FOR
Y = 1
TO
10
300
FOR
Q = 1
TO
4
400
P = P + P *
.02
500
NEXT
Q
600
NEXT
Y
650
PRINT P
700
END
Our
preceding
example
is
us
ed to calculate the value
of
1000
after
10
years
with
an
interest rate
of
8%
compounded
quarterly.
On
e
error
that you should take care to avoid
when
us
ing
nested

Other manuals for Atari 800

Related product manuals