GOSUB-RETURN

Syntax:

GOSUB mysub

SUB mysub:
    RETURN
ENDSUB

Jump into a sub-code with GOSUB. Define a SUB with SUB mark: (Don’t leave the colon). End a SUB with ENDSUB. SUBs must be placed at the end of the main program. It’s not allowed to have code between ENDSUB and SUB.
A SUB can be leaved before ENDSUB by calling RETURN. You can call GOSUB from within another SUB.
A good way to create new SUBs is the command “new SUB” from the Project menu.

Sample:

GOSUB draw
SHOWSCREEN
MOUSEWAIT
END

SUB draw:
   PRINT “Eine Sub”, 100, 100
    RETURN // Jump back to GOSUB
    PRINT “You won’t see this!”, 100, 150
ENDSUB