R
rubyrus
Does anyone think if this the warning makes any sense?
irb(main):002:0> puts "abc" if (a=true)
(irb):2: warning: found = in conditional, should be ==
abc
I thought in ruby, everything is an expression, so a=true should return
true, and
if (true) is totally valid. Why does it give the warning?
Or is this a language design thing?
irb(main):002:0> puts "abc" if (a=true)
(irb):2: warning: found = in conditional, should be ==
abc
I thought in ruby, everything is an expression, so a=true should return
true, and
if (true) is totally valid. Why does it give the warning?
Or is this a language design thing?