Hacker News new | past | comments | ask | show | jobs | submit login

I feel like, if you mean "if" say "if". As opposed to doing a little dance that has the effect of "if true do this, otherwise do that".



One could argue that if you mean "map" use "map", not a little dance with a for loop. I'm inclined to say that the same argument could he applied to "if", but without seeing what their particular code looks like I don't know for sure.


And if you are mapping not to a value but to the execution of a statement, should that be map instead of for?


Well, I agree with that. If you're mapping use map instead of a for loop.


Yeah to me the example in the post looks very obtuse and unreadable compared to the standard "if" version. I prefer clarity in my code especially when I have to come back to it in six months to debug it.




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

Search: