DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
missrahee profile image
Adam Misrahi

I'm a fan of ruby's each method for the fact that you can use it as an interface to make any object enumerable (or what other languages call iterable).

I particularly love it for the lazy evaluation. You can iterate over a collection of infinite size like a prime number generator or like something I did the other day, wrap a large remote resource but make it feel like any other local one. You just stream in as much of it as you need and no more.