scal的函數定義(day01)

函數定義、函數作爲參數、函數調用: //定義函數 /*def 是函數,sum是函數名,a是變量,b是變量,返回值Int*/ def sun(a:Int,b:Int):Int={return a+b} //函數的寫法,提前返回值的時候可以用return def abs(a:Int,b:Int):Int={ if(a>b){ return a; }
相關文章
相關標籤/搜索