RosettaCodeData/Task/Detect-division-by-zero/Eiffel/detect-division-by-zero.e
Ingy döt Net 86c034bb8b new files
2013-04-10 12:38:42 -07:00

21 lines
433 B
Text

class MAIN
creation main
feature main is
local
x, y: INTEGER;
retried: BOOLEAN;
do
x := 42;
y := 0;
if not retried then
io.put_real(x / y);
else
print("NaN%N");
end
rescue
print("Caught division by zero!%N");
retried := True;
retry
end
end