Hacker News new | ask | show | jobs
by draw_down 3428 days ago
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".
2 comments

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.