是否有理由将scala中的赋值计算为Unit?

时间:2013-01-29 17:42:49

标签: scala

  

可能重复:
  What is the motivation for Scala assignment evaluating to Unit rather than the value assigned?

为什么scala中的赋值会评估为Unit?

var s:String = null

s = "hello"     // works
s += " world" 

(s = "hello") += " world" // dramatic problem

或括号中有什么神奇的东西吗?

0 个答案:

没有答案