This technique is also known by other labels: early returns or return early pattern.
And I'm a big fan.
However, it's worth pointing out that not everyone is on board -- I've even seen it explicitly discouraged in company coding guidelines. Not quite spaces vs tabs battleground but up there :D
This technique is also known by other labels: early returns or return early pattern.
And I'm a big fan.
However, it's worth pointing out that not everyone is on board -- I've even seen it explicitly discouraged in company coding guidelines. Not quite spaces vs tabs battleground but up there :D
Oh, there are tons of strange things in coding guidelines that companies create. I think that's a whole separate topic :)
My personal favorite from a coding guide: Always use pre-increment in for loops.