' GOTO/GOSUB — Jump and subroutine call demonstration
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL x AS LONG

    PRINT "GOTO demonstration:"
    GOTO SkipLabel
SkipLabel:
    PRINT "Skipped to label with GOTO"
    PRINT

    PRINT "GOSUB demonstration:"
    x = 10
    GOSUB DoubleIt
    PRINT "x doubled = " + STR$(x)
    x = 25
    GOSUB DoubleIt
    PRINT "x doubled = " + STR$(x)

    GOTO Done

DoubleIt:
    x = x * 2
    RETURN

Done:
    PRINT
    PRINT "All done."

    FUNCTION = 0
END FUNCTION
