A co-worker and myself are having a debate on whats best. Both concepts work and work well but is there a general consensus on not making a call to exit?
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?