0Pricing
Kotlin Academy · Lesson

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

  1. What Is a Lambda? Syntax and Types
  2. Passing Lambdas to Functions
  3. it: The Implicit Parameter
  4. filter, map, and find on Collections
← Back to Kotlin Academy