Timeline for Best practice on if/return
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 25, 2012 at 8:15 | comment | added | Mark Hurd |
If it was a choice between this and code with the else clauses included, I'd choose the latter because the compiler will effectively ignore them as well. Though it would depend on the else if not increasing the indentation more than the original once -- if it did I'd agree with you. But my choice would be to drop the else completely if that style was allowed.
|
|
Jul 24, 2012 at 19:29 | comment | added | Chuck Conway | If you have multiple checks this method could get a bit long. Returning out of each if clause is similar to using the goto statement to skip sections of the code. | |
Jul 20, 2012 at 12:50 | comment | added | user | Personally, I hope that I never have to work with your code. | |
Jul 20, 2012 at 10:56 | history | made wiki | Post Made Community Wiki by DPD | ||
Jul 20, 2012 at 8:13 | history | answered | Shadur-don't-feed-the-AI | CC BY-SA 3.0 |