EasyManua.ls Logo

Commodore 128D - Page 305

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...
RETURN
RUN
This
example
traps
a
"division
by
zero
error"
in
line
20
if
0
is
entered
in
line
10.
If
zero
is
entered,
the
program
goes
to
line
100,
where
you
are
asked
to
input
another
number
besides
0.
Line
110
returns
to
line
20
to
complete
the
calculation.
Line
50
asks
if
you
want
to
repeat
the
program
again.
If
ytiu
do,
press
the
Y
key.
—Return
from
subroutine
RETURN
This
statement
is
always
paired with
the
GOSUB
statement.
When
the
program
encounters
a
RETURN
statement,
it
goes
to
the
state
ment
immediately
following
the
last
GOSUB
command
executed.
If
no
GOSUB
was
previously
issued,
then
a
RETURN
WITHOUT
GOSUB
ERROR
message
is
displayed
and
the
program
stops.
All
subroutines
end
with
a
RETURN
statement.
See
COLLISION.
EXAMPLE:
10
PRINT
"ENTER
SUBROUTINE"
20
GOSUB
100
30
PRINT
"END
OF
SUBROUTINE"
90
STOP
100
PRINT
"SUBROUTINE
1"
110
RETURN
This
example
calls
the
subroutine
at
line
100
which
prints
the
mes
sage
"SUBROUTINE
1"
and
RETURNS
to
line
30,
the
rest
of
the
program.
—Execute
BASIC
program
1)
RUN
[line
#]
2)
RUN
"filename"
[,Ddrlve
numberRON
|
,>Udevlce
number]
Once
a
program
has
been
typed
into
memory
or
LOADed,
the
RUN
command
executes
it.
RUN
clears
all
variables
in
the
program
before
starting
program
execution.
If
there
is
a
number
following
the
RUN
command,
execution
starts
at
that
line
number.
If
there
is
a
filename
following
the
RUN
command,
the
named
file
is
loaded
from
the
disk
drive
and
RUN,
with
no
further
action
required
of
the
user.
RUN
may
be
used
within
a
program.
The
default
drive
number
is
0
and
default
device
number
is
8.
297
BASIC
7.0
ENCYCLOPEDIA—Basic
Commands
and
Statements

Table of Contents

Other manuals for Commodore 128D

Related product manuals