Lead Developer, business owner, US Army veteran. I build things for the web. My website is a bunch of HTML pages that didn't need a framework. Yours can be too!
I once argued AGAINST early return, but then I tried it and I can't imagine why I didn't use it before.
Early on in my career (a long time ago in a galaxy far far away and all that) I had been taught a rule that a function should only ever have one return in order to make it clear what was being returned, and I clung to that rule for too long.
It's one of the best changes I've made to my code style in years. I love it.
I am an OpenEdge (aka Progress) developer that loves clean code and good looking applications that are easy to use. My main pet project is the Progress DataDigger
I once argued AGAINST early return, but then I tried it and I can't imagine why I didn't use it before.
Early on in my career (a long time ago in a galaxy far far away and all that) I had been taught a rule that a function should only ever have one return in order to make it clear what was being returned, and I clung to that rule for too long.
It's one of the best changes I've made to my code style in years. I love it.
I was taught exactly the same thing, but when you adhere to that you end up with massive blocks. Early return is king!