Hacker News new | ask | show | jobs
by EnergyAmy 1081 days ago
The rule of thumb I use is if something has side effects, I use a for loop. If it doesn't, I use whatever functional constructs the language gives me. They're obviously equivalent approaches, but the choice provides some semantics to people reading the code: look carefully at for loops for side effects.

What's interesting is that you start to see less need for side effects in most cases. Still some, but a lot less than you'd think.