From: marc Date: 2008-05-01T22:24:22+09:00 Subject: Re: References in Ruby Marcin Tyman said... > 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". The way I think of it is that 10 and 50 are objects. So, 1. a = 10 # a -> the object 10 2. b = a # b -> the object 10 3. a = 50 # a -> the object 50 4. puts b # -> 10 And Mikael's explanation helps too, imo: >> a = "Hello" => "Hello" >> b = a => "Hello" >> a.upcase! => "HELLO" >> b => "HELLO" -- Cheers, Marc