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

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

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

SUB ShowMessage(BYVAL msg AS STRING, BYVAL 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
