Sharp mz-800 Owner's Manual page 75

Hide thumbs Also See for mz-800:
Table of Contents

Advertisement

GOSUB ~ RETURN
Format
GOSUB
{<line number >
<label>
RETURN
Abbreviated Format
Explanation
GOS. ~ RE.
The GOSUB statement transfers program control to a subroutine identified with
<label> or beginning at the line number specified in <line number>. After the
subroutine has been executed, control is returned by the RETURN statement to the
line following the GOSUB statement.
A subroutine is a set of statements that may be used more than once in a program.
One subroutine may call another subroutine which may call still another subrou-
tine. Nesting of such subroutines is limited only by the available memory space.
Each called subroutine must have a RETURN statement at the end.
10 INPUT A, B
20 GOSUB 100
30 B=C
¥
40 GOSUB 100
10 — 60 Main program
50 PRINT C
60 END
100
C=AT2+B
110 RETURN
} 100 — 110 Subroutine
6-18

Advertisement

Table of Contents
loading

Table of Contents