qb45advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
ON...GOSUB Statement Programming Example
◄QuickSCREEN► ◄Details► ◄Example► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
ON...GOSUB Statement Programming Example
This example causes program control to branch to one of three
subroutines, depending on the value of Chval:
CLS ' Clear screen
Attend = 20
Fees = 5 * Attend
PRINT "1 Display attendance at workshops"
PRINT "2 Calculate total registration fees paid"
PRINT "3 End program"
PRINT : PRINT "What is your choice?"
Choice:
DO
ch$ = INKEY$
LOOP WHILE ch$ = ""
Chval = VAL(ch$)
IF Chval > 0 AND Chval < 4 THEN
ON Chval GOSUB Shop, Fees, Progend
END IF
END
Shop:
PRINT "ATTENDANCE IS", Attend
RETURN Choice
Fees:
PRINT "REGISTRATION FEES ARE $"; Fees
RETURN Choice
Progend:
END