From: Gennady Bystritsky Date: 2008-04-29T23:17:26+09:00 Subject: Re: References in Ruby [Sorry for the top posting, webmail not quoting properly] Apparently you are thinking about references in C++ sense -- once assigned, subsequent assignment operations change the underlying object. It is NOT like that in Ruby when you are assigning to variables. Think about it more like a pointer assignment in C. char c = 'c', d = 'd'; char* p = &c; p = &d; The last operation does not change the content of variable c, simply changes the pointer value in p to "refer" to d. Gennady. ________________________________________ From: list-bounce@example.com [list-bounce@example.com] On Behalf Of Marcin Tyman [m.tyman@interia.pl] Sent: Tuesday, April 29, 2008 4:02 AM To: ruby-talk ML Subject: References in Ruby 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". Thanks for answer. -- Posted via http://www.ruby-forum.com/.