HP Pascal/iX Programmer's Guide (31502-90023)

11- 4
BEGIN
IF NOT iok THEN i := 0 ELSE newj;
END;
BEGIN {prog}
iok := FALSE;
TRY
prompt('Enter an integer for i:');
read(i); {An error here transfers control to newij}
iok := TRUE; {Not executed if read(i) causes an error}
TRY
read(j); {An error here transfers control to newj}
RECOVER
newj; {An error here transfers control to newij}
RECOVER
newij; {An error here aborts the program}
END. {prog}
The following example illustrates how nested TRY-RECOVER statements
divide the responsibility of error recovery.
Example 3