the code is
def c=(foo)
p "hello"
return foo + 1
end
p self.c = 3
d = (self.c = 3)
p d
and it will print out 3 only... in other words, the returned value 4 is not assigned to d
, why?
Setters return their argument (or right operand, depending on how you look at it) — always.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With