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
Information
- Show
- FrequencyUpdated Biweekly
- PublishedJune 17, 2019 at 5:00 AM UTC
- Length16 min
- Episode165
- RatingClean