
...
GOTO Label2
...
Label2: PRINT "This is a character string label."
4.6 Subroutines
A subroutine is a set of instructions given a particular name or a line label. Users can
simplify their programming by breaking programs into smaller logical subroutines. A
subroutine will be executed when being called by a GOSUB command. For example,
ON KEY(1)GOSUB KeyF1
...
KeyF1:
PRINT "F1 is pressed."
RETURN
The command RETURN marks the end of the subroutine and tells the processor to return to
the caller. A subroutine has to be appended at the end of the main BASIC program.
A subroutine can be defined with or without a pair of brackets. For example,
SUB Subroutine1( )
...
PRINT "Subroutine1 is executed."
END SUB
...
SUB Subroutine2
...
PRINT "Subroutine2 is executed."
END SUB
Kommentare zu diesen Handbüchern