Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Assuming I know the ternary operator, I find the first version superior. Why? It only says "value = " once. I know immediately what the action of the code is when I start reading. Starting with an if makes me worry that the two code paths diverge, and also makes it take analysis to realize that 'value' is definitely assigned.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: