From: Jeremy Bopp Date: 2011-05-27T01:14:59+09:00 Subject: Re: Method that mutates object On 5/26/2011 11:07, jay s. wrote: > I understand that using String#replace works for the String class, but > what if you were writing a random method for Integer that takes a number > and sets it equal to some other number. > > Ex. > > x = 7 > > class Integer > def crazy > ...set x to 5... > end > end > > > now when you call x the value is 5 Instances of Integer are immutable, so you can't do that. The documentation for Fixnum (a descendant of Integer) mentions this in the Overview section: http://rdoc.info/stdlib/core/1.9.2/Fixnum -Jeremy