On 05/14/2015 04:17 PM, Mark Morgan Lloyd wrote:
>
> So in effect, both an exit and a raise first execute the innermost
> finally, then look for procedure end or exception block repeating as
> necessary.
Yes.


> These are the only cases where syntax needs to be unwound in this way.
>

Well... There is also continue and break. The following program will
also execute the Finally statements before exiting the loop:

==== Code Begin ====
Program TestFinally;

{$mode ObjFPC}

Procedure Whatever;
Begin
    WriteLn('Finally.');
End;

Begin
    While True do
        Try
            Break
        Finally
            Whatever
        End;

    Repeat
        Try
            Continue
        Finally
            Whatever
        End
    Until True;
End.
==== Code End ====

-- 
Ewald


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

Reply via email to