From: dblack@... Date: 2006-12-15T01:41:22+09:00 Subject: Re: Hi -- On Fri, 15 Dec 2006, Maksim Bartenev wrote: > > On 12/14/06, pat eyler wrote: >> >> On 12/14/06, Maksim Bartenev wrote: >> > Hi! >> > >> > I'm quite new to ruby language. Can anyone please explain why in the >> > attached ruby code the setter methods return their argument >> > instead of the last statement's value, and the string 'weird >> > stuff' gets output only once? Methods ending with equal signs return the rhs, rather than their last value, so that they'll be more assignment-like. That way, this: x = 1 and this: obj.thing = 1 have very close to the same sematics. As for 'weird stuff' getting printed only once: it's because you've got dummy = true (a local variable assignment) instead of self.dummy = true (a call to self.dummy=) in try_dummy2. David -- Q. What's a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)