EasyManua.ls Logo

Commodore Plus 4 - Page 152

Commodore Plus 4
234 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...
NEXT NEXT
Wanable,.,.
.variable
\
The
NEXT
statement
is
used
with
the
FOR
statement.
When
the
com
puter
encounters
a
NEXT
statement,
it
goes
back
to
the
corresponding
FOR
statement
and
checks
the
loop
variable.
(See
FOR
statement
(or
more
detail.)
If
the
loop
is
finished,
execution
proceeds
with
the
state
ment
after
the
NEXT
statement.
The
word
NEXT
may
be
followed
by
a
variable
name,
a
list
of
variable
names
separated
by
commas,
or
no
variable
names.
If
there
are
no
names
listed,
the
last
loop
started
is
the
one
being
completed.
If
the
variables
are
given,
they
are
completed
in
order
from
left
to
right.
EXAMPLE:
_
10FORL
-
1TO
10:NEXT
20
FOR
L -
1TO
10:NEXTL
_
30
FOR
L
=
1TO
10:FORM
-
1
TO
10:
NEXT
M, L
QJI
ON
expression
<
GOTO
GOSUB
>
line
#7
[.line
#2,...)
This
command
can
make
the
GOTO
and
GOSUB
statements
into
spe
cial
versions
of
the
IF
statement.
The
word
ON
is
followed
by
a
formula,
then
either
GOTO
or
GOSUB.
and
a
list
of
line
numbers
separated
by
commas,
if
rhe
result
of
the
calculation
of
the
formula
(expression)
is
1,
the
first
line
in
the
list is
executed.
If
the
result
is
2,
the
second
line
number
is
executed,
and
so
on.
If
the
result
is
0,
or
larger
than
the
number
of
line
numbers
in
the
list,
the
next
line
executed
is
the
state
ment
following
the
ON
statements.
If
the
number
is
negative,
an
ILLEGAL
QUANTITY
ERROR
results.
EXAMPLE:
WhenX=1.ON
sends
control
to
the
10
INPUT
X:IF
X-
0
THEN
10
first
line
number
in
the
list.
20
ON
X
GOTO
50, 30, 30,
70
WhenX-
2,
ON
25
PRINT
"FELL
THROUGH":GOTO
10
sends
control
to
the
second
line
(30),
etc.
30
PRINT
"TOO HIGH":GOTO
10
50
PRINT
"TOO
LOW":GOTO
10
70
END
143

Other manuals for Commodore Plus 4

Related product manuals