BCX Console Demonstration Program s134.bas |
GLOBAL i INPUT "Enter a number ( 1,2,3 ) ", i ON i CALL Sub_one, Sub_two, Sub_three ON i GOSUB One, Two, Three ON i GOTO Label_One, Label_Two, Label_Three END ' VERY necessary so we don't fall into the code below Label_One: PRINT "Label One" END Label_Two: PRINT "Label Two" END Label_Three: PRINT "Label Three" END One: PRINT "Subroutine One" RETURN Two: PRINT "Subroutine Two" RETURN Three: PRINT "Subroutine Three" RETURN SUB Sub_one PRINT "Sub One" END SUB SUB Sub_two PRINT "Sub Two" END SUB SUB Sub_three PRINT "Sub Three" END SUB
Result:
Enter a number ( 1,2,3 ) 3 Sub Three Subroutine Three Label Three