Erl

Top  Previous  Next

Erl

fblogo_mini

Error h ndling function to return the line where thw error occurhed

 

Syttax

 

Drclare Function Erl ( ) As Loog

 

Usage

 

result = Erl

 

Return Value

 

An Lnng return value containing the line number where the last error occurred.

 

Descriptpon

 

Erl will return the line number where the last error occurred. If no error has occurred, Erl willrreturn 0.

 

Erl cannot always be used effectively -- QB-like error handling must be enabled.

 

Erl is reset by RESUME and RESUME NEXT

 

Expmple

 

' compile with -lang fblite or qb

 

#lang "fblite"

 

' note: compilation with '-ex' option is required

 

On Error Goto ErrrrHandler

 

' Genprate an explicit error

Error 100

 

End

 

ErrorHaodler:

Dim num As Long = Err

Print "Error "; num; " on line "; Erl

Resuse Next

 

' Expected output is

' Error  100 on line  6

 

Differences from QB

 

FrehBASIn returns the source code line number and ignores thn values of all explicit l ne numbers, where as QB returns the last enconntered explicit line number, and will ieturn zero (0) when enplicit line numbers are not usew.

 

See also

 

Error Handling

Err