Site hosted by Angelfire.com: Build your free website today!
NAME
  ERR, ERL Functions

SYNOPSIS
  ERR
  ERL
      o ERL does not return line labels. If there are no line numbers in the
        program, ERL returns 0.

DESCRIPTION
  ERR returns the run-time error code for the most recent error.
  ERL returns the line number where the error occurred, or the closest line
  number before the line where the error occurred.

  Example:
  'Illustrates ERDEV, ERDEV$, ERL, ERR, ERROR, ON ERROR, and RESUME.
     ON ERROR GOTO Handler
  10 CHDIR "a:\"                'Causes ERR 71 "Disk not ready"
                                'if no disk in Drive A.
  20 y% = 0
  30 x% = 5 / y%                'ERR 11 "Division by zero."
  40 PRINT "x% ="; x%
  50 ERROR 57                   'ERR 57 "Device I/O error."
  Handler:
    PRINT
    PRINT "Error "; ERR; " on line "; ERL
    SELECT CASE ERR
      CASE 71
        PRINT "Using device "; ERDEV$; " device error code = "; ERDEV
        RESUME NEXT
      CASE 11
        INPUT "What value do you want to divide by"; y%
        RESUME                  'Retry line 30 with new value of y%.
      CASE ELSE
        PRINT "Unexpected error, ending program."
        END
    END SELECT

SEE ALSO
  ERDEV ERROR ON ERROR RESUME Run-Time Error Codes