Functions
Standard alone, independent, not part of a class
1
(x: Int) => x + 1
2
val addOne = (x: Int) => x + 1
3
println(addOne(1)) // 2
4
val add = (x: Int, y: Int) => x + y
5
println(add(1, 2)) // 3
Copied!
​
Last modified 1yr ago
Copy link