GLBasic User Manual

Main sections

ENDSUB

SUB name:
...
ENDSUB

...
GOSUB name



The ENDSUB command signals the end of the subroutine code block.
A SUB can be left if required before the ENDSUB statement is processed by using the RETURN command.


// 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


Output:
Setup_Complete

See also...