HTBasic Help
×
Menu
Index

RETURN

Returns to the program line following the last GOSUB line.
 
 RETURN
 
Usage:
200 GOSUB 300
...
299 STOP
300 PRINT A,B,C
310 RETURN
Example: RETURN.BAS
Description:
The GOSUB statement transfers control to a subroutine; the RETURN statement transfers control back to the next statement following the GOSUB. You can have many GOSUBs to the same subroutine and a RETURN occurring in that subroutine returns control to the statement following the specific GOSUB used to get to the subroutine. You can only enter a subroutine by using GOSUB. If you don't use GOSUB, the RETURN statement causes an error when executed.
The RETURN keyword is also used to return values from user-defined functions. See DEF FN for an explanation of RETURN used in this way.
See Also: