1
對於下面的方法模式匹配,什麼是檢查傳入的數組是無的方式(也就是空的java來回地..)斯卡拉如何爲無陣列
val x = Array(22.0,122,222,322,422,522,622,722,822,922)
def stddev(arr :Array[Double]) = {
arr match {
case None => 0
..
的錯誤是:
<console>:11: error: pattern type is incompatible with expected type;
found : None.type
required: Array[Double]
Note: if you intended to match against the class, try `case _: <none>`
case None => 0
^
確定這是正確的,THX。請考慮提出這個問題。 – javadba