M
michael.j.cannon
Why do these two expressions give different results when foo is undefined?
foo if (foo = 3) # => NameError: undefined local variable or method `foo' for main:Object
if (foo = 3); foo end # => 3
Granted, an operator like ||= does something handy, even though it's inconsistent with foo = foo || 3
but the if-expression-vs-modifier inconsistency just seems wrong.
- Mike
foo if (foo = 3) # => NameError: undefined local variable or method `foo' for main:Object
if (foo = 3); foo end # => 3
Granted, an operator like ||= does something handy, even though it's inconsistent with foo = foo || 3
but the if-expression-vs-modifier inconsistency just seems wrong.
- Mike