Resume

[<<<] [>>>]

The piece of code executed when an error happens is usually tries to repair the condition that caused the error. When the reparation is done the program has to resume its normal operation. To perform it the program can use the statement RESUME. This statement has three forms.

RESUME

continues the execution at the line that caused the error. In other words the line is executed again.

RESUME NEXT

continues the execution of the program after the line that caused the error. This means that the program does not try to execute the line that caused the error. Finally the statement

RESUME label

resumes the program execution at the label specified after the keyword.

The interpreter remembers the resume point when an error occurs. After execution the statement RESUME this resume point is cleared and the last error code is set to zero. In other words the execution returns from error correction to normal operation.

Although the statement RESUME clears the last error value, there is another way to clear this value. You can execute the statement

ERROR 0

This causes an artificial error of code zero, which means no error. This also sets the last error code to zero meaning no error. Although the statement ERROR 0 seems to nullify an error this does not switch execution to normal from error correction, because still there is a resume point remembered.

Executing a resume statement in normal operation, when there is no resume point remembered causes an error.


[<<<] [>>>]