"Fear Dubh" <feardubh / spam.spam> schrieb im Newsbeitrag 
news:cvslbj$9ns$1 / reader01.news.esat.net...
>
> "ts" <decoux / moulon.inra.fr> wrote in message
> news:200502271128.j1RBSA019680 / moulon.inra.fr...
>> >>>>> "F" == Fear Dubh <feardubh / spam.spam> writes:
>>
>> F> Is there a difference between:
>> F>   for foo in bar do ...
>> F> and
>> F>   bar.each do |foo| ...
>>
>> uln% ruby -e 'for a in [12] do end; p a'
>> 12
>> uln%
>>
>> uln% ruby -e '[12].each do |a| end; p a'
>> -e:1: undefined local variable or method `a' for main:Object (NameError)
>> uln%
>>
>>
> Thanks!
>
> Does each have a fatter frame then?
> Is "for ... in ... do ..." more efficient?

I would believe not, but you can test this yourself (hint "ruby -r profile" 
and module Benchmark).

Indenpendently of that I strongly recommend the usage of "each" as it is 
used 99% of the cases and it's simply standard.  Although it's not an 
enforced convention, people will expect that and it makes everybody's life 
easier to stick to some conventions.

Kind regards

    robert