DEV Community

Discussion on: Why avoid Ruby's for .. in?

Collapse
 
dfockler profile image
Dan Fockler

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.

Collapse
 
renannobile profile image
Renan Lourençoni Nobile

Looking from that perspective it's a good option to use each.

Thank you