From: Robert Klemme Date: 2009-02-24T06:09:28+09:00 Subject: Re: pointer and other questions On 23.02.2009 21:40, Daniel Schoch wrote: >> ListElem = Struct.new :prev, :next, :data >> l1 = ListElem.new >> li.data = "foo" >> l2 = ListElem.new >> l2.prev = l1 >> l1.next = l2 >> l2.data = "bar" >> p l1 >> > Ok, that works and solved my problem. Thanks. > > I also found this comment in one of the ruby getting started texts. >> Ruby variables hold references to objects and the = operator copies >> references. > > Now what about this ? > b = 1 > a = b > b = 2 > Shouldn't 'a' now contain 2 if the above statement is true? Clearly not > every variable is a reference. Please think again. It's the same logic as above. Cheers robert