[fpc-pascal]'try-except'-problem

Tobias Hermann tobih at mayn.de
Sat Sep 16 02:26:09 CEST 2000


haven't you to use something like this? :

try
  ..
except
  on Exception do
   writeln('Error');
end;

 ???

Tobi

----- Original Message ----- 
From: Dominik Schulz <dschulz at c-nit.de>
To: <fpc-pascal at lists.freepascal.org>
Sent: Friday, September 15, 2000 10:39 PM
Subject: [fpc-pascal]'try-except'-problem


> Hi!
> 
> I'm new to Free Pascal an Object Pascal. So I tried the following
> program:
> -----------------------
> program testtry;
> {$mode objfpc}
> {$I-} file://I'm not really sure whether this switch is usefull here.
> uses crt;
> 
> var a, b : word;
> 
> begin
>   writeln('start');
>   a :=  1;
>   b :=  a - 1;
>   try
>     a := 1 div b;
>   except
>     writeln('Error');
>   end;
> 
>   writeln('end');
> end.
> -----------------------
> 
> This program always crashes with RE 200.
> Why doesn't the try-except-block avoid this?
> 
> Thank you in advance!
> 
>                         ciao, Dominik
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 





More information about the fpc-pascal mailing list