Skip to content

Comment on Dear Reddit, Hacker News...parent

Comments

The 'for i in list' syntax exists in Ruby if you want to just loop over a list. The block syntax though gives you the flexibility to use map/collect, select, reject, or inject instead of plain each over the list to give you some functional advantages.

Exactly. It's not that Ruby lacks the ability to do some things, but rather, has its own additional idiomatic way of accomplishing the same task.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.