多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ def ma(x: Int)(y:Int) = x * y ma(2)(6) println(ma(2)(6)) ~~~ ~~~ scala> def mb(x: Int) = (y: Int) => x * y mb: (x: Int)Int => Int scala> mb(2) res1: Int => Int = $$Lambda$1075/1699826397@79e7188e scala> mb(2)(7) res2: Int = 14 ~~~ 定义个默认值 ~~~ def ma(x: Int)(implicit y:Int = 100) = x * y println(ma(2)) ~~~ 隐式值导入 他会寻找同类型的,找到类型一样的就用这个值 但是不能在多个类中找到 ~~~ object Context { implicit val aaa: Int = 1024 } object CaseDemo extends App { def ma(x: Int)(implicit y:Int = 100) = x * y import Context._ println(ma(2)) } ~~~