代码如下:
object ScalaInAction {
// 这三个代码是等价的
def mul(x:Int,y:Int) = x * y
def mul(x:Int) = (y:Int) => x * y
def mul1(x:Int)(y:Int) = x * y
def main(args: Array[String]): Unit = {
println(mul(5 ,6))
println(mul(5)(6))
println(mul1(5)(6))
}
}
结果如下



