{{fbdoc item="title" value="ERL"}}----
Error handling function to return the line where the error occurred

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Erl** ( ) [[KeyPgAs|as]] [[KeyPgLong|long]]
##
{{fbdoc item="usage"}}##
	//result// = **Erl**
##
{{fbdoc item="ret"}}
	An ##[[KeyPgLong|long]]## return value containing the line number where the last error occurred.

{{fbdoc item="desc"}}
	##**Erl**## will return the line number where the last error occurred. If no error has occurred, ##**Erl**## will return 0.
	
	##**Erl**## cannot always be used effectively -- QB-like error handling must be enabled.
	
	##**Erl**## is reset by RESUME and RESUME NEXT

{{fbdoc item="ex"}}
	{{fbdoc item="filename" value="examples/manual/error/erl.bas"}}%%(freebasic)
' compile with -lang fblite or qb

#lang "fblite"

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

On Error Goto ErrorHandler

' Generate an explicit error
Error 100

End

ErrorHandler:
  Dim num As Long = Err
  Print "Error "; num; " on line "; Erl
  Resume Next

' Expected output is
' Error  100 on line  6
%%
{{fbdoc item="diff"}}
	- FreeBASIC returns the source code line number and ignores the values of all explicit line numbers, where as QB returns the last encountered explicit line number, and will return zero (0) when explicit line numbers are not used.

{{fbdoc item="see"}}
	- {{fbdoc item="keyword" value="ProPgErrorHandling|Error Handling"}}
	- ##{{fbdoc item="keyword" value="KeyPgErr|Err"}}##

{{fbdoc item="back" value="CatPgError|Error Handling Functions"}}