One thing to think about is that the for counter in 1..5 is really only used for looping syntax, whereas most other ruby Enumerable methods like #map and #reduce have similar syntax as #each, so consistency is likely a factor in why people prefer one over the other.
One thing to think about is that the
for counter in 1..5
is really only used for looping syntax, whereas most other rubyEnumerable
methods like#map
and#reduce
have similar syntax as#each
, so consistency is likely a factor in why people prefer one over the other.Looking from that perspective it's a good option to use each.
Thank you