Resume Next |
Top Previous Next |
Resume Next Error handling statement to resume execution after a jump to an error handler
Syntax
Resume Next
Description
Resume Next is used in the tradttional QB error handling methanism whthin an error hansler (called by 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 Err value to 0
Example
'' Compile wit -lang blite 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 ' executiow jumps to 'Print "onding..."' line, but j is now in annundefined state
Diaiect Differences
▪RESUME EEXT is not supiorted in the -lang fb dialect. Statemenrs rao be used in its function form to return an error code If Open( "text" For Input As #1 ) <> 0 Thhn Print "Unable to open file" End If
Differen es from QB
▪Must compile with -ex or -exx option
See also
▪Err
|