相关疑难解决方法(0)

在Scala中,你能否使一个匿名函数有一个默认参数?

这有效:
scala> def test(name: String = "joe"): Boolean = true
test: (name: String)Boolean

我希望这可以以同样的方式工作:
scala> val test: String => Boolean = { (name: String = "joe") => true } <console>:1: error: ')' expected but '=' found.

scala anonymous-function

7
推荐指数
2
解决办法
2904
查看次数

标签 统计

anonymous-function ×1

scala ×1