Edoardo Rossi wrote in post #1136041:
> Hi Arup.

> if() when used as a modifier has its own context... its scope.
> So the assignment is never seen outside of the if and 'bar' it's
> undefined.

See another snippet :

>> puts "hi" if x = 2
(pry):11: warning: found = in conditional, should be ==
hi
=> nil
>> x
=> 2
>>

How then here `x` does print **2** ?

-- 
Posted via http://www.ruby-forum.com/.