' SUB/CALL — Subroutine invocation
#COMPILE EXE
#DIM ALL

SUB ShowTitle()
    PRINT "SUB/CALL Demo Program"
    PRINT STRING$(40, 45)
    PRINT
END SUB

SUB PrintLine(n AS LONG)
    LOCAL i AS LONG
    FOR i = 1 TO n
        PRINT "-"
    NEXT i
    PRINT
END SUB

SUB ShowMessage(msg AS STRING, count AS LONG)
    LOCAL i AS LONG
    FOR i = 1 TO count
        PRINT STR$(i) + ": " + msg
    NEXT i
END SUB

FUNCTION PBMAIN() AS LONG
    ShowTitle()
    PrintLine(20)
    ShowMessage("Hello from SUB", 3)
    PrintLine(10)
    ShowMessage("Goodbye", 2)

    FUNCTION = 0
END FUNCTION
