Edoardo Rossi wrote in post #1136041:

> 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.

But 'a' gets defined after the error. Does it mean that it first gets 
defined in the inner scope and passed to the outer scope?

[1] pry(main)> puts a if a = 0.zero?
NameError: undefined local variable or method `a' for main:Object
from (pry):1:in `__pry__'
[2] pry(main)> a
=> true
[3] pry(main)>

If anything that is defined gets into this inner scope and anything that 
is defined (or modified) inside the inner scope gets out, then this is 
not really a scope...

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