A Higher-Order Function is a function that:
// Takes a function 'operation'
fun calculate(a: Int, b: Int, operation: (Int, Int) -> Int): Int {
return operation(a, b)
}
// Usage
val sum = calculate(5, 10) { x, y -> x + y }
val mul = calculate(5, 10) { x, y -> x * y }
This is the foundation of Kotlin's functional programming features like map, filter, and callbacks.
Mark this when you can explain the answer in your own words.
Help fellow developers prepare for interviews
Sharing helps the Android community grow ๐