A lambda is a kind of function without a name. You can treat a function like a value — store it in a variable, pass it as a parameter, or use it directly in collection operations. In Kotlin collections' map, filter, forEach methods, you'll see lambdas everywhere.
kotlin
fun main() {
val sum = { x: Int, y: Int -> x + y }
println("Sum of 5 and 3 is ${sum(5, 3)}")
}You should see
Sum of 5 and 3 is 8Summary
Lambdas make Kotlin expressive and turn collection processing into something effortless.