tb0262.pp 596 B

12345678910111213141516171819202122232425262728293031
  1. { Old file: tbs0305.pp }
  2. { Finally is not handled correctly after inputting 0 }
  3. {$mode objfpc}
  4. uses
  5. (* sysutils does not work correctly with DPMIEXCP unit
  6. anyway, its not needed anymore
  7. since the exception handler is now in system unit
  8. {$ifdef go32v2}
  9. dpmiexcp,
  10. {$endif} *)
  11. sysutils;
  12. var i,j,k:real;
  13. const except_called : boolean = false;
  14. begin
  15. i:=100;
  16. j:=0;
  17. try
  18. k:=i/j;
  19. writeln(k:5:3);
  20. except
  21. k:=0;
  22. writeln('Illegal Input');
  23. except_called:=true;
  24. end;
  25. if not except_called then
  26. begin
  27. Writeln('Error in except handling');
  28. Halt(1);
  29. end;
  30. end.