RosettaCodeData/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/PascalABC.NET/exceptions-catch-an-exception-thrown-in-a-nested-call.pas
2024-11-04 21:53:44 -08:00

26 lines
349 B
ObjectPascal

type
U0 = class (Exception) end;
U1 = class (Exception) end;
procedure baz(i: integer);
begin
if (i = 0) then raise new U0
else
raise new U1;
end;
procedure bar(i: integer) := baz(i);
procedure foo;
begin
for var i := 0 to 1 do
try
bar(i);
except
on U0 do Writeln('U0 Caught');
end;
end;
begin
foo;
end.