Runtime error
Runtime errors are errors, which are determined at runtime of the program. Errors of that kind can be "division by zero", negative operands for the sqare root or generally wrong parameters for procedures and functions. Normally such an error leads to an error message and the program stops.
The runtime error message gives you the current program counter value, which allows you to locate the corresponding program code. You can do this with the function from the options menu. Here you are asked for the program counter value, which you got from the runtime error message. Input this value and then select the program. The program will be compiled again and the compilation stops at the position of the runtime error.
Sometimes one would like to handle the error at runtime themself. For example one could read all MEMOs until an error arises, because there is no further memo. Here the error is only a message that one achieved the last MEMO. With ERROROFF it is possible to switch the normal error handling off. Then errors do not lead to an error message and an abort. In case of an error the integer variable ERROR% is set. Now one can query whether an error arose. Because also unforeseen errors are no longer announced, it's recommended to switch the normal error handling on with ERRORON directly after these special cases. ERRORON and ERROFF work accumulative, to allow nesting of procedures which switch error handling. This requires to strictly pair ERRORON and ERROROFF.
While the normal error handling is switched off, the variable ERROR% must be reset to 0 again after evaluation of ERROR%.
User defined procedures can raise an error using error.
|