Radio Shack TRS-80 PC-4 Owner's Manual page 55

Trs-80 pc-4
Hide thumbs Also See for TRS-80 PC-4:
Table of Contents

Advertisement

The numerical expression following the GOSUB statement indicates the initial line
number of the subroutine area. Without a RETURN statement at the end of the
subroutine area, program execution cannot return to the main routine.
Example;
10e
GOSUB
1000
999
10ee A=B
subroutine area
The numerical expression following a GOSUB statement may be either a numerical
variable or a calculation formula. In the case of a variable or a numerical expression, the
subroutine which is called out will be different depending on the numerical value
~ontained
in the variable or the result of the numerical expression. When a
"4f'
is
attached prior to the numerical expression, another program area (P0 through P9) will
be used as the subroutine. This method is very convenient because even different
programs can use the same subroutine,
Example;
P.0
200 . GOSUB #9
999 END
P9
1e A=B
999'RETURN
-52-
P.2
3ee GOSUB #9
999 END

Advertisement

Table of Contents
loading

Table of Contents