What Is a Lambda? Syntax and Types
Understand lambda expressions: syntax, parameter types, and return values.
Lambdas in One Sentence
A lambda is an anonymous function — a function value you can store in a variable, pass to another function, or return.
Basic Lambda Syntax
A lambda is written between curly braces: parameters on the left of ->, body on the right.
fun main() {
val greet = { name: String -> "Hello, $name!" }
println(greet("World"))
}All lessons in this course
- What Is a Lambda? Syntax and Types
- Passing Lambdas to Functions
- it: The Implicit Parameter
- filter, map, and find on Collections