From: Kedar Mhaswade Date: 2009-01-11T05:24:26+09:00 Subject: Re: value of an expression? > > In this case the assignment with 1 is never executed and hence the value > of the variable does not change. The result of the _whole_ expression > however is either nil (in case of the condition evaluating to false) or > the result of evaluating the expression before the "if". > > Assignments happen to be defined as expressions in Ruby (everything is - > there is no distinction between statement and expression like in some > other languages). So they have a result like evaluating any other > expression like (1 + 3) for example. The way it is defined the result > of an assignment expression is the right hand side. You can view the > change of the variable as a side effect of evaluating the assignment > expression. > Thanks Robert. I get it now. Regards, Kedar -- Posted via http://www.ruby-forum.com/.