QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

RETURN is used in GOSUB procedures to return to the original call code line or a specified line label.

Syntax

RETURN [{linelabel linenumber}]

Parameter(s)

Usage

Example(s)

Returns after a Gosub.


FOR a = 1 TO 10
  PRINT a
  IF a = 5 THEN GOSUB five
NEXT
END       'END or SYSTEM stop the program before the execution of a sub procedure

five:
  PRINT "Aha! Five!"
RETURN 


 1
 2
 3
 4
 5
Aha! Five!
 6
 7
 8
 9
 10

Returns to a specific line label.


GOSUB hey 
PRINT "it didn't go here." 
hoho: 
  PRINT "it went here." 
END 

hey: 
RETURN hoho 


it went here.

See Also