EasyManua.ls Logo

Laser 128 - Gosub

Laser 128
255 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...
BASIC COMMANDS AND
STATEMENTS
3.16
GOSUB
...
RETURN
Purpose:
Format:
To
direct
the
program
flow
into,
and
return
from,
a
subroutine.
GOSUB
linenumber
RETURN
Comments: A
subroutine
may
be
called
any
number
of
times
from
within
a
program,
and
it
is possible
to
call
another
subroutine
from
within
a
subroutine,
which,
in
turn,
may
call
another
subroutine.
Nesting
of
subroutines
can
be 25 levels
deep.
The
linenumber
needed
in
the
GOSUB
statement
is
the
first
line
of
the
subroutine
.
The
RETURN
statement
terminates
the
execution
of
the
subroutine,
and
returns
the
interpreter
to
the
line
immediately
following
the
most
recent
GOSUB
statement.
However,
there
is no
way
that
the
interpreter
can
distinguish
between
a
subroutine
and
ordinary
program
lines. So,
to
a
void
executing
the
subroutine
when
it
is
not
required,
you
sho
uld
put
a
GOTO,
STOP,
or
END
in
the
line
before
it
starts.
II-44

Table of Contents