Timeline for Elegant ways to handle if(if else) else
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 13, 2018 at 9:27 | comment | added | Mateen Ulhaq | @klaar Early exiting is easier to understand, particularly for 3 or more condition branches. | |
| Oct 17, 2017 at 13:24 | comment | added | Piskvor left the building | "If something exists and meets this condition" is fine. "if something exists and do something tangentially related here and meets this condition", OTOH, is confusing. In other words, I dislike side effects in a condition. | |
| Jul 23, 2017 at 13:44 | history | edited | Deduplicator | CC BY-SA 3.0 | added syntax-highlighting |
| Oct 28, 2015 at 7:43 | comment | added | klaar | I do too! I personally dislike the way people use multiple returns some premises are not met. Why don't you invert those ifs and execute your code if they are met? | |
| Dec 2, 2011 at 12:40 | comment | added | Gorpik | I, on the contrary, like this kind of "if something exists and meets this condition" statement. +1 | |
| Dec 1, 2011 at 22:07 | comment | added | moteutsch | Pretty gross to put so much code in an if statement, in my opinion. | |
| Dec 1, 2011 at 7:08 | comment | added | Anthony | This is how I would do it. | |
| Dec 1, 2011 at 5:53 | history | made wiki | Post Made Community Wiki by outis | ||
| Nov 30, 2011 at 12:45 | history | answered | frozenkoi | CC BY-SA 3.0 |