From: Logan Capaldo Date: 2005-12-10T05:28:23+09:00 Subject: Re: new to Ruby - pls help in translating this On Dec 9, 2005, at 2:31 PM, Dan Diebolt wrote: >> variables are more like labels on objects than containers for objects > > There is something very fundamental about what you are saying > here but I don't quite understand. Could you elaborate on this with > perhaps an example? > > > --------------------------------- > Yahoo! Shopping > Find Great Deals on Holiday Gifts at Yahoo! Shopping Well basically, all variables in ruby are references (or pointers, whatever you want to call them), but they are actually even less "clingy" than that. maybe an example will help x = "a string" y = x # this doesn't do something like x.copy nor is it even equalivalent to typing y = "a string" # it more like saying # x = # "a string" # y = y.upcase! #=> "A STRING" x #=> "A STRING" Just think of varibles as a way to refer to a memory address If x and y "contain" anythjing it is a memory address and they both have the same memory. Basically they are pointers. Except when they aren't. Fixnums for instance are stored as values. As are symbols. I think I might have over complicated this. Maybe someone else can explain it better.