165: Learning Kotlin: Lambda Expressions Part 1

Fragmented - Android Developer Podcast

In this episode, Donn talks about Kotlin Lambda Expressions. He explains the syntax and how to build a couple of simple lambda expressions with and without type inference and declaration. We wrap up with a small example of passing a small lambda with multiple values to a function. See the show notes below for more info. This is part 1 of a multi-part series on Lambda Expressions in Kotlin.

The basic syntax of a lambda expression:

The codeBody is the only section that is not optional.

Double lambda expression (doubles an integer) with type inference

Double string multi-line lambda with type inference.

Type declaration in a lambda

Preview of next week … passing a lambda to a function

To listen to explicit episodes, sign in.

Stay up to date with this show

Sign in or sign up to follow shows, save episodes, and get the latest updates.

Select a country or region

Africa, Middle East, and India

Asia Pacific

Europe

Latin America and the Caribbean

The United States and Canada