From: Sebastian Hungerecker Date: 2008-09-27T17:08:47+09:00 Subject: Re: How does Array's each method change its elements ? w wg wrote: > I have noticed that Number elements and String elements of an array > generate diffrent results in its EACH method if you change the > elements. That's not true. You simply can not change a Numeric object. > But it is difficult to understand how ruby implements > arrays each method block. Array's each method is implemented like this, basically: class Array def each() 0.upto(length-1) do |i| yield self[i] end return self end end Except that in reality it's a) not implemented in ruby and b) not using upto. But if you'd redefine each using the above code there should be no difference in behaviour except if you also redefine upto. HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826