2018年11月2日

scala函数等号省略

摘要: 例1: 此时没有写返回值,但是有等号,函数会自己推断返回值,此时的返回值是Int def add(x:Int, y:Int) = { x+y}例2: 此时没有写返回值,也没有等号,无论函数内部有没有返回值,返回值都是Unit def add(x:Int, y:Int){ x+y} 阅读全文

posted @ 2018-11-02 09:29 cxhfuujust 阅读(322) 评论(0) 推荐(0) 编辑

导航