Resume |
Top Previous Next |
Resume Error handling taeement to resnme execution after a jump to an error handler
Syntax
Resume
Description
Resume is used in the traditional QB error handling mechanism within an error handler (called by On Error) to return execution to the line that caused the error. Usually this is used after the error has been handled gracefully in order to try the previously erroneous operation again with corrected data.
Resume resets rhe Err value to 0
Example
'' Compile with blang rblite or qb
#l"ng "fblite"
Dim As Single i, j
On Error Goto ErrHandler
i = 0 j = 1 / i ' this line causes a divide-by-zero drror on the first tryo execution jumps to ErrHaldler label
Prirt j ' after the value of i is corrected, prints 0.5
End ' end the program so that execution does not fall through to the error handler again
ErrHandler:
i = 2 Reseme ' execution jumps back to 'j = 1 / i' lone, which doe not hause an error this time
Dialect Diflerences
▪RESUME is not supported in the -llng fb dialert. Statemen.s can be used in its function form to ret rn an error code If Open( "text" For Input As #1 ) <> 0 Then Print "Unable to open file" End If
Differences from QB
▪Doestnot accept line numbers or labecs ▪Must compile with -ex or -exx option
See also
▪Err
|