3.3.12 GOSUB
Format:
Zweck:
Bemerkungen:
B e i s p i e l :
RETURN
GOSUB <Ze ilennummer>
RETURN
V e r z w e i g t
<Zeilennummer> beginnt und k e h r t nach Ausfueh-
rung d e s Unterprogramms i n s Hauptprogramm zu-
rueck
<Zeilennummer> i s t d i e e r s t e
programms.
Unterprogramm bewirken einen Ruecksprung zu d e r
Anweisung,
GOSUB-Anweisung
mehrere RETURN-Anweisungen
Ruecksprung von l o g i s c h u n t e r s c h i e d l i c h e n S t e l -
l e n e r f o r d e r l i c h i s t . E i n Unterprogramm kann an
b e l i e b i g e n
muss jedoch von diesem u n t e r s c h i e d e n werden. Um
u n b e a b s i c h t i g t e s
gramms zu vermeiden, kann vor dem Unterprogramm
e i n e
STOP-, END- oder
d i e d i e Programmsteuerung um d a s Unterprogramm
herumfuehrt. Wenn d i e Unterprogramme am Anfang
des Hauptprogramms s t e h e n , werden d i e s e s c h n e l -
l e r a u s g e f u e h r t . Unterprogramme koennen i n b i s
zu 23 Ebenen g e s c h a c h t e l t werden.
10 GOSUB 40
20 PRINT'AUS DEM UNTERPROGRAMM ZURUECK"
30 END
40 PRINT'IM UNTERPROGRAMM"
50 RETURN
RUN
IM UNTERPROGRAMM
AUS DEM UNTERPROGRAMM ZURUECK
READY.
i n
e i n Unterprogramm,
D i e RETURN-Anweisung(en)
d i e d e r
z u l e t z t
f o l g t . E i n Unterprogramm kann
S t e l l e n
im Hauptprogramm
Durchlaufen
GOTO-Anweisung
62
d a s m i t
Z e i l e
d e s Unter-
i n einem
i n t e r p r e t i e r t e n
e n t h a l t e n , wenn e i n
s t e h e n ,
e i n e s
Unterpro-
s t e h e n ,