A high order function is a function which accepts another function as a parameter or returns another function. We just saw how we can use a function as a property, so it's quite easy to see that we can accept another function as a parameter or that we can return another function from a function. As stated previously, technically the function that receives or returns another function (it may be more than one) or does both is called a high-orderfunction.
In our first lambda example in Kotlin, the invokeSomeStuff
function was a high-order function.
The following is another example of high-order function:
fun performOperationOnEven(number:Int,operation:(Int)->Int):Int { if(number%2==0) { return operation(number) } else { return number } } fun main(args: Array<String>) { println("Called with 4,(it*2): ${performOperationOnEven(4, {it*2})}") println("Called with 5,(it*2): ${performOperationOnEven(5, ...