`prev Menu next`

Propagation of an Exception☆
If an exception has occurred on the execution of a function definition or a subprogram, the exception is propagated to the statement invoking it unless the line is within a when-block.
Example. The graph of y=1/x

    100 DEF f(x)=1/x
    110 SET WINDOW -2,2,-2,2
    120 FOR x=-2 TO 2 STEP 0.01
    130   WHEN EXCEPTION IN
    140      PLOT LINES:x,f(x);
    150   USE
    160      PLOT LINES
    170   END WHEN
    180 NEXT x
    190 END

Explanation.
If the PLOT-line at 140-line is executed when x=0, the DEF-statement at 100-line is executed and it causes an exception of zero division. And then the exception is passed back to 140-line, the exception is handled with the WHEN-block.
[Supplement]
If an exception is propagated to a statement invoking a routine, 100000 is added to the value of EXTYPE.