EasyManua.ls Logo

Apple IIe - Page 102

Apple IIe
320 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...
102
Apple
lie
Users
Handbook
The
program
lines
following
the
FOR
statement
will
be
executed
until
the
NEXT
statement
is
encountered.
At
this
point
,
the
counter
is
incremented
(assuming
positive
STEP
value)
by
the
STEP
value.
The value
for
the
counter
is
then
compared
with
its
final
value b.
As
long
as
the
counter's
value does
not
exceed
the
final value,
the
program
will
branch
back
to
the
statement
following
the
FOR statement. This
entire
process
will
then
be
repeated.
When
the
counter
's value exceeds
the
specified final value (b),
the
statement
following
the
NEXT
statement
will
be
executed.
This
will
exit
the
FOR
..
NEXT
loop.
One
FOR
..
NEXT
loop
may
be
placed
within
another
FOR
..
NEXT
loop.
This
is
known
as
nesting
or
nested loops.
When
FOR
..
NEXT
loops
are nested, each FOR
..
NEXT
loop
must use a
different
variable
name
for
the
counter.
Also,
the
NEXT
statement
for
the
inside
loop
must
appear
before
the
NEXT
statement
for
the
outside
loop.
However,
if
both
loops
end
at
the
same
point,
a
single NEXT
statement
may
be
used
to
end
these.
Be
certain
that
the
variable
for
the
inside
loop
appears
before
the
variable
for
the
outside
loop.
A NEXT statement such
as
the
following
:
NEXT
J,I
would
be
interpreted
as
follows:
NEXT
J
NEXT I
Example
10 FOR X = 1
TO
-2
STEP
-1
20 PRINT X
30
NEXT
X
40 END
]RUN
[Ret]
1
0
-1
-2
(

Other manuals for Apple IIe

Related product manuals