Main sections
SUB
SUB name:
...
ENDSUB
...
GOSUB name
The SUB command defines a subroutine - a logical grouping of commands like a FUNCTION - except that unlike a FUNCTION it does not return a value or take any arguments.
Define a SUB with SUB mark: (ensure you include the colon!) End a SUB with ENDSUB.
SUBs must be placed after the main program. Having code between ENDSUB and the next SUB command is not allowed.
A SUB can be left if required before the ENDSUB statement is processed by using the RETURN command. You can call GOSUB to jump to a subroutine from within another subroutine.
A good way to create new subroutines is to use the command "new SUB" from the Project menu.
// GOSUB subcode; <-> RETURN;
a$="-"
GOSUB Setup
PRINT a$, 0, 0
SHOWSCREEN
MOUSEWAIT
// End of main program
// From here on just SUBs
// No more code out of SUB and ENDSUB
SUB Setup:
a$="Setup_Complete"
RETURN // Back to GOSUB call
a$="Das erscheint nie / This won't appear"
ENDSUB