`prev Menu next`

WHEN EXCEPTION USE and HANDLER
Exception handling process can be described as an internal procedure so that more than one when-block has an identical exception-handler in common.
An exception handler described as an internal procedure is called a detached handler.
A detached handler begins with a HANDLER line and ends with an END-HANDLER line.
A HANDLER line holds a name of the handler. The rule for naming a handler is same as that of a numerical variable.
When you use a detached handler, replace WHEN EXCEPTION IN ～ USE ～ END WHEN with WHEN EXCEPTION USE ～ END WHEN. A WHEN-EXCEPTION-USE line holds the name of the detached handler.
Example

    100 WHEN EXCEPTION USE h
    110    PRINT 1/A
    120 END WHEN
    130 WHEN EXCEPTION USE h
    140    PRINT SQR(-1)
    150 END WHEN
    160 HANDLER h
    170    PRINT EXTYPE
    180 END HANDLER
    190 END