Using fpc 3.0.4, Lazarus 2.0, the following simple program

program tryfinally;

begin
  try
    Writeln('before finally');
  finally
     Writeln('inside finally. Before Exit');
     exit; //<----why isn't it executed?
  end;
  Writeln('after try finally block');

end.


gives


P:\RAM64>tryfinally.exe
before finally
inside finally. Before Exit
after try finally block



I have tried putting the try finally block inside a procedure, the same happened.
program tryfinally;

procedure Test;
begin
    try
      Writeln('before finally');
    finally
       Writeln('inside finally. Before Exit');
       exit;
    end;
    Writeln('after try finally block');
end;

begin
  Test;

end.

Dennis
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to