EasyManua.ls Logo

Commodore 128D - Page 304

Commodore 128D
427 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...
EXAMPLES:
10
FOR
I
=
1
TO
3
20
READ
X
30
SUM
=
X
+
SUM
40
NEXT
50
RESTORE
60
GOTO
10
70
DATA
10,20,30
10
READ
A,B,C
20
DATA
100,500,750
30
READ
X,Y,Z
40
DATA
36,24,38
50
RESTORE
40
60
READ
S,RQ
This
example
READs
the
data
in
line
70
and
stores
it
in
numeric
variable
X.
It
adds
the
total
of
all
the
numeric
data
items.
Once
all
the
data
has
been
READ,
three
cycles
through
the
loop,
the
READ
pointer
is
RESTOREd
to
the
beginning
of
the
program
and
it
returns
to
line
10
and
performs
repetitively.
This
example
RESTORES
the
DATA
pointer
to
the
beginning
data
item
in
line
40.
When
line
60
is
executed,
it
will
READ
the
DATA
36,24,38
from
line
40,
since
you
don't
need
to
READ
line
20's
DATA
again.
RESUME
—Define
where
the
program
will
continue
(RESUME)
after
an
error
has
been
trapped
RESUME[line#|
NEXT]
This
statement
is
used
to
restart
program
execution
after
TRAPping
an
error.
With
no
parameters,
RESUME
attempts
to
re-execute
the
statement
in
which
the
error
occurred.
RESUME
NEXT
resumes
execution
at
the
statement
immediately
following
the
one
containing
the
error;
RESUME
followed
by
a
line
number
will
GOTO
the
specific
line
and
resume
execution
from
that
line
number.
RESUME
can
only
be
used
in
program
mode.
EXAMPLE:
10
INPUT
"
ENTER
A
NUMBER";A
15
TRAP
100
20B
=
100/A
40
PRINT"THE
RESULT
=";B:
PRINT"THE
END"
SO
INPUT
"DO
YOU
WANT
TO
RUN
IT
AGAIN
(Y/N)";Z$:IF
Z$
=
"Y"THEN10
60
STOP
100
INPUT"ENTER
ANOTHER
NUMBER
(NOT
ZERO)";A
110
RESUME
20
296
BASIC
7.0
ENCYCLOPEDIA—Basic
Commands
and
Statements

Table of Contents

Other manuals for Commodore 128D

Related product manuals