Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the reason why for-loops are rejected in Ruby is because of it's Smalltalk heritage.

In smalltalk there are no loops and no ifs... just methods that are executed on a condition. So 'each:' isn't any more complicated than a 'whileTrue:'.

Just take a look at this Smalltalk examples[1]: ----- [ condition ] whileFalse: [ statements ] [ condition ] ifTrue: [ statements ]

aCollection do: [ :var1 :var2 | statements ] ----

[1] http://www.cincomsmalltalk.com/tutorials/version7/tutorial1/...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: