寫(xiě)一個(gè)兩個(gè)數(shù)字相加的方法
fun sum(x: Int, y: Int): Int {
return x + y
}
fun sum(x: Int, y: Int) = x + y
val i = { x: Int, y: Int -> x + y }
var j: (Int, Int) -> Int = { x, y -> x + y }
寫(xiě)一個(gè)兩個(gè)數(shù)字相加的方法
fun sum(x: Int, y: Int): Int {
return x + y
}
fun sum(x: Int, y: Int) = x + y
val i = { x: Int, y: Int -> x + y }
var j: (Int, Int) -> Int = { x, y -> x + y }