Why does a Ruby setter return the passed value, rather than the final value of the instance variable?

后端 未结 0 1984
广开言路
广开言路 2020-12-10 07:04

Ordinarily, Ruby methods return the value of the last expression in the method. For setters of the form name=, however, it seems like

Given the following

相关标签:
回答
  • 消灭零回复
提交回复
热议问题