From: Rick DeNatale Date: 2008-09-28T23:01:41+09:00 Subject: Re: How does Array's each method change its elements ? 2008/9/27 Sebastian Hungerecker : > Radosław Bułat wrote: >> There is also "<<" for integers but it works >> different and doesn't change objects because of fact that integers are >> immutable in Ruby. > > Well, I would assume that if Integers were mutable, << would still not be a > mutating method as that would really not make much sense. I think that the key idea here is that the block argument of each (or any iterator method for that matter) can't affect an element of the collection unless it invokes a mutating method on that element. The fact that immutable objects like integers don't HAVE any mutating methods (by definition) is a bit of an aside. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/