BCX Console Demonstration Program s104.bas

DIM j

CLS

PRINT "Calling Subroutine 9 times ..." : PRINT

FOR j = 1 TO 9
  GOSUB qwerty
NEXT j

PRINT : PRINT "All Done!"

END                       ' Don't accidently fall into the subroutine 

QwErTy:                   ' BCX Subroutine Labels are NOT case sensitive 

PRINT " This is instance >>", j, " <<  of the subroutine call."

RETURN                    ' Return from subroutine back to main program

Result:

 This is instance >> 1 <<  of the subroutine call.
 This is instance >> 2 <<  of the subroutine call.
 This is instance >> 3 <<  of the subroutine call.
 This is instance >> 4 <<  of the subroutine call.
 This is instance >> 5 <<  of the subroutine call.
 This is instance >> 6 <<  of the subroutine call.
 This is instance >> 7 <<  of the subroutine call.
 This is instance >> 8 <<  of the subroutine call.
 This is instance >> 9 <<  of the subroutine call.

All Done!