bas7advr.hlp (
Topic list)
RETURN Statement Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
The RETURN statement returns control from a subroutine.
RETURN [{linelabel | linenumber}]
Usage Notes
■ Without a line label, RETURN continues execution where an event
occurred (for event handling), or at the statement following the
GOSUB (for subroutine calls). GOSUB and RETURN without a line label
can be used anywhere in a program, but the GOSUB and corresponding
RETURN must be at the same level.
■ The linelabel or linenumber in the RETURN statement causes an
unconditional return from a GOSUB subroutine to the specified line.
RETURN with a line label or line number can return control to a
statement in the module-level code only, not procedure-level code.
■ A RETURN statement cannot be used to return control to a calling
program from a procedure defined by SUB. Use EXIT SUB.
■ BASIC's SUB procedures provide a better-structured alternative
to GOSUB subroutines.