16

A co-worker and myself are concerned with whats best.

To call exit within a procedure to avoid doing the rest of the code as in ...

if Staging.Current = nil then
  Exit;

DoSomethingA(FileNameA);  
DoSomethingB(FileNameB);  
Staging.DeleteCurrent;

or to not call exit and instead wrap it in a begin and end

if Staging.Current <> nil then  
  begin   
    DoSomethingA(FileNameA);  
    DoSomethingB(FileNameB);  
    Staging.DeleteCurrent; 
  end;

Both work. I prefer to use the exit statement since it results in fewer lines of code and looks cleaner to me, but is there any reason or any consensus among programmers to avoid using exit to leave a procedure?