2
我嘗試使用foreach來計算String的Unicode值的乘積。爲什麼我在StringOps.foreach中的表達式不正確
scala> var s:Long = 1;"Hello".foreach(s *= _)
s: Long = 9415087488
scala> var s:Long = 1;"Hello".foreach(s = s * _)
<console>:10: error: missing parameter type for expanded function ((x$1) => s.$times(x$1))
"Hello".foreach(s = s * _)
^
我不知道爲什麼S = S * _是不正確的在這裏,什麼是* = _和s = S * _