BASICHELP.HLB  —  ON

1  –  ERROR

  The ON ERROR statement transfers program control to a  specified  line
  or program module.  If an error is pending when the ON ERROR statement
  executes, control is transferred immediately.  Otherwise,  control  is
  transferred  when an error occurs.  For new program development, it is
  recommended that you use WHEN blocks.

1.1  –  GOBACK

  After BASIC executes an ON ERROR GO BACK in  a  subprogram  or  DEF,
  control transfers to the calling (main) program when an error occurs
  under certain conditions.

  Example

  ON ERROR GO BACK

1.1.1  –  Syntax

      { ONERROR  }
      { ON ERROR } GO BACK

1.2  –  GOTO

  The ON ERROR GOTO statement transfers program control to a specified
  line or label in the current program unit when an error occurs under
  certain conditions.

  Example

   5     ON ERROR GOTO 19000

1.2.1  –  Syntax

      { ONERROR  } { GO TO }
      { ON ERROR } { GOTO  } target

1.3  –  GOTO 0

  The ON ERROR GOTO 0 statement disables user error handling and  passes
  control  to the BASIC error handler when an error occurs under certain
  conditions.

  Example

  ON ERROR GOTO 0

1.3.1  –  Syntax

               { GO TO }
      ON ERROR { GOTO  } 0

2  –  GOSUB

  The ON GOSUB statement transfers program control  to  one  of  several
  subroutines, depending on the value of a control expression.

  Example

  150    ON Control% GOSUB 100, 200, 300 OTHERWISE 500

2.1  –  Syntax

      ON int-exp GOSUB target,...  [ OTHERWISE target ]

3  –  GOTO

  The ON GOTO statement transfers program  control  to  one  of  several
  lines, depending on the value of a control expression.

  Example

  330    ON Index% GOTO 700, 800, 900 OTHERWISE 1000

3.1  –  Syntax

                 { GO TO }
      ON int-exp { GOTO  } target,... [ OTHERWISE target ]
Close Help