Gosub/Return - Sanyo MBC-550 Series User Manual

Table of Contents

Advertisement

GOSUB/RETURN
Purpose
GOSUB / RETURN instructs a branch from the main program
to the subroutine program or return from the subroutine
to the main program.
Form
GOSUB <llne number>
RETURN [<line number>]
Description
(1) <line number> is the starting line number of the
subroutine program. Cline number> must be Cinteger
constant>.
(2) The RETURN statement comes at the end of the sub­
routine program.
returns to the next statement after the GOSUB.
When RETURN is executed the control
(3) Calls of subroutines can be nested. (Another sub­
routine program can be called by a subroutine program.)
However, the currently executing subprogram cannot call
itself.
(*0 Following a GOTO, STOP, or END statement, a subrou­
tine program may be entered in any part of the main
program.
Otherwise, the main control might accidental­
ly fall into the subroutine program.
3-50

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents