News for hackers. Stuff that matters.
Re:Ruby 3.0.0 RC1 by dragonwriter on Monday December 21, 2020 @02:01PM (#25498163)
> Even in Ruby, no one uses loops, they use Enumerable.

Enumerable#each is quite deeply equivalent to a for…in loop.

But no one uses for loops in Ruby because not only are they basically an alternate syntax for Enumerable#each, but they became non-idiomatic because in earlier versions (through at least 1.8.x, IIRC; I think this may have been resolved by the switch to YARV in 1.9) “for” had some implementation inefficiencies which made it notably slower than #each.

There are no comments on this comment yet.