RESUME NEXT
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgResumenext
- 最后更新: 2018-05-14
跳转到错误处理程序后用于恢复执行的错误处理语句
语法
Resume Next说明
Resume Next 用于传统 QB 错误处理机制中的错误处理程序(由 On Error 调用),将执行返回到导致错误的行的下一行。通常用于避免执行同一行并再次引发错误。
Resume Next 将 Err 值重置为 0
示例
start GeSHi
vb
'' 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 stateend GeSHi
方言差异
- RESUME NEXT 在 -lang fb 方言中不受支持。语句可以以其函数形式使用以返回错误代码
start GeSHi
vb
If Open( "text" For Input As #1 ) <> 0 Then
Print "Unable to open file"
End Ifend GeSHi
与 QB 的区别
另请参阅
ErrResume- 错误处理
返回 目录