From: Tim Becker Date: 2006-05-16T20:35:11+09:00 Subject: Re: learn to program > My real issue is with the excerpt from the book, which would make new > programmers think they can do whatever they want to an object inside a > method and not have it affect anything outside of it. Clearly that is > not the case. The book is trying to make a point which is really important and central to programming. It's difficult to explain, but once it "clicks" it seems trivial: the variable and the actual object the variable points at are completely distinct. Manipulating the variable doesn't change the object it points to, it just makes the variable point to a different object: a = "Some object" # `a` now points at "Some object" b=a # `b` now also point at "Some object" a = nil # `a` now points at nil, but this doesn't change "Some object" if you'd do this: a = a.upcase `a` now points at the new Object returns by calling the `upcase` method, i.e. you've changed the location that `a` points to. Had you done this: a.upcase! this would have changed the object that `a` is pointing at instead of changing what the variable points at. -tim