scala之高阶函数-CSDN博客

网站介绍:文章浏览阅读36次。object HanShu { def opt(x:Int,y:Int,f:(Int,Int)=>Int)={ f(x,y) } def main(args: Array[String]): Unit = { println(opt(1, 3, (x1, x2) => x1 + x2)) println(opt(1, 3, (x1, x2) => x1 * x2)) }}object HanShu2 { def opt(x:String,