Hi -- On Tue, 29 Apr 2008, Rick DeNatale wrote: > On Tue, Apr 29, 2008 at 7:02 AM, Marcin Tyman <m.tyman / interia.pl> wrote: >> Hi guys, >> >> I was quite a bit confused when write following code: >> >> a = 10 >> b = a >> a = 50 >> >> puts b # -> puts 10 >> >> Why?? Since everything is a reference in Ruby I expected "puts 50". > > Well not everything IS a reference in Ruby. I think you are suffering > from a variation of the common nuby problem of misunderstanding the > distinction between variables and objects. > > Objects have identity and state, sometimes that state is changeable > (only by sending the object a message). > > Variables refer to objects. Variables DON"T refer to other objects. s/objects\.$/variables./ I think. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates!