{{fbdoc item="title" value="RESUME NEXT"}}----
Error handling statement to resume execution after a jump to an error handler

{{fbdoc item="syntax"}}##
	**Resume Next**
##
{{fbdoc item="desc"}}
	##**Resume Next**## is used in the traditional QB error handling mechanism within an error handler (called by ##[[KeyPgOnerror|On Error]]##) to return execution to the line after the one that caused the error.  Usually this is used to avoid executing the same line and causing the error again.
	
	##**Resume Next**## resets the ##[[KeyPgErr|Err]]## value to 0

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

#lang "fblite"

Dim As Single i, j

On Error Goto ErrHandler

i = 0
j = 5
j = 1 / i ' this line causes a divide-by-zero error; execution jumps to ErrHandler label

Print "ending..."

End ' end the program so that execution does not fall through to the error handler again

ErrHandler:

Resume Next ' execution jumps to 'Print "ending..."' line, but j is now in an undefined state
%%

{{fbdoc item="lang"}}
	-  RESUME NEXT is not supported in the //[[CompilerOptlang|-lang fb]]// dialect. Statements can be used in its function form to return an error code
{{fbdoc item="filename" value="examples/manual/check/KeyPgResumenext_1.bas"}}%%(freebasic)
If Open( "text" For Input As #1 ) <> 0 Then
  Print "Unable to open file"
End If
%% 

{{fbdoc item="diff"}}
	- Must compile with //[[CompilerOptex|-ex]]// or //[[CompilerOptexx|-exx]]// option

{{fbdoc item="see"}}
	- ##[[KeyPgErr|Err]]##
	- ##[[KeyPgResume|Resume]]##
	- [[ProPgErrorHandling|Error Handling]]

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