我必须customer.id
平等171
。在执行以下if
-statement之后,它立即返回"customer.id = 0"
:
customer.id #=> 171
if customer.id = 0
puts "customer.id = 0" # => customer.id = 0
end
谁能解释为什么会这样?
您正在分配:
if customer.id = 0
应该比较一下:
if customer.id == 0
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句