Live data from Hacker News

Replace Nested Conditional With Guard Clauses

martinfowler.com

1–3 of 3 posts

Re: Replace Nested Conditional With Guard Clauses

#3
post #2

Is the example fail-safe? Also wouldn't this result in the same machine code in either case (i.e. the code's simply being written in a more condensed fashion?)

"Also wouldn't this result in the same machine code in either case"

Well yes. But Martin Fowler's recommendation in this case has nothing to do with the machine code optimization and everything with the readability of the actual code.