Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 109
    This is a REALLY bad practice. See stackoverflow.com/questions/48088/… for more info about why it's bad. Commented Sep 16, 2008 at 2:47
  • 23
    Agreed. A return within finally{} ignores any exception thrown in try{}. Scary! Commented Oct 22, 2008 at 7:12
  • 10
    @dominicbri7 Why do you think it's a better practice? And why should it be different when the function/method is void? Commented Jul 12, 2011 at 20:26
  • 8
    For the same reason I NEVER use goto's in my C++ codes. I think multiple returns makes it harder to read and more difficult to debug (of course in really simple cases it doesn't apply). I guess that's just personnal preferrence and in the end you can achieve the same thing using either method Commented Jul 13, 2011 at 11:47
  • 18
    I tend to use a number of returns when some kind of exceptional case happens. Like if(there is a reason not to continue) return; Commented Feb 22, 2013 at 23:24