Does the statements in the Finally block still execute in this piece of code ?

waza123 picture waza123 · Dec 23, 2011 · Viewed 9.4k times · Source

Will finally block execute? if I pass exit; ?

procedure someProc;
begin
    Try
      Exit;
    finally
     do_something;
    end;
end;

Answer

Seth Carnegie picture Seth Carnegie · Dec 23, 2011

Yes, finally blocks always execute, even if you call Exit somewhere. They wouldn't be worth much if they weren't always executed.