Functions

Standard alone, independent, not part of a class

(x: Int) => x + 1
val addOne = (x: Int) => x + 1
println(addOne(1)) // 2
val add = (x: Int, y: Int) => x + y
println(add(1, 2)) // 3

Last updated