The below Kotlin program will add up two numbers with the use of the add function.
fun main(args: Array<String>) { fun add(x : Int, y : Int) = x + y val result = add(3, 5) println(result) }
The add function above will return the outcome of x plus y to the result’s variable.