I found that parentheses are not required when partial function used as parameter in Scala
val array = Array(2)
array.map(x => x + 1)
array.map { case x => x + 1 }
{ case x => x + 1 }
defines a partial function here, so it should be array.map({ case x => x + 1 })
, but there are no parentheses.So what happend here? Is that syntactic sugar?