RESUME Statement ---------------------------------------------------------------------------- Action Resumes program execution after an error-handling routine is finished. Syntax RESUME { 0 | NEXT | line} Remarks The different forms of the RESUME statement redirect program flow as described in the following list. ----------------------------------------------------------------------------- Part Description ---------------------------------------------------------------------------- RESUME 0 Program execution resumes with the statement that caused the error, or at the most recent call out of Part Description ---------------------------------------------------------------------------- or at the most recent call out of the error-handling procedure or module. RESUME NEXT Execution resumes with the statement immediately following the one that caused the error, or with the statement immediately following the most recent call out of the error-handling procedure or module. line Execution resumes at line, a label or a line number. The argument line must be in the same procedure (for local error-handlers) or within the same module (for module-level error-handlers). Part Description ---------------------------------------------------------------------------- error-handlers). The location where execution resumes is based on the location of the error handler in which the error is trapped, not necessarily on the location where the error occurred. The following table summarizes the resumption rules for the RESUME 0 statement. ----------------------------------------------------------------------------- Error handler Location of error Where program resumes ---------------------------------------------------------------------------- Local Same procedure Statement that caused error Error handler Location of error Where program resumes ---------------------------------------------------------------------------- Module level Same module Statement that caused error Local or module level Another procedure, same Statement that last or another module called out of the procedure or module that contains the error handler Note If BASIC had to search for the error handler (the error handler that contains the RESUME statement is in a procedure or module other than the one in which the the error occurred), then the last statement executed in that procedure (or module) is the last call out of that procedure or module. As a rule, avoid using a line argument with a RESUME statement in a module-level error handler, unless you expect errors to occur only at the module level. If you use a RESUME statement outside an error-handling routine, BASIC generates the error message RESUME without error. When an error handling routine is active and the end of the program text is encountered before executing a RESUME statement, BASIC generates the error message No RESUME. This also is true if an END statement (or an END SUB, END FUNCTION, or END DEF statement for a local error handler) is executed before a RESUME. Note Programs containing error-handling routines must be compiled with either the -E (On error) or -X (Resume next) options when you are compiling from the BASIC command line. See Also ON ERROR Example See the ON ERROR statement programming example, which uses the RESUME statement.