在 Ruby 中,为什么你可以这样写:
# b is not defined yet.
#
if b = true
a = b
end
# => a = true
但不是单线:
a = b if b = true
# => NameError: undefined local variable or method `b' for main:Object
在 Ruby 中,为什么你可以这样写:
# b is not defined yet.
#
if b = true
a = b
end
# => a = true
但不是单线:
a = b if b = true
# => NameError: undefined local variable or method `b' for main:Object