Kotlin Keyword to Reference Single Parameter
Learn about an important keyword and how to use it in Kotlin.
The keyword it
In Kotlin, the keyword it
is a shorthand notation that allows us to reference a single parameter in a lambda or anonymous function, thereby making our code more concise and readable. We typically use it
when we have a lambda with only one parameter. Instead of explicitly naming the parameter, we can use it
to reference it. Here’s an example:
Get hands-on with 1400+ tech skills courses.