bas7advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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.