Programming in Kotlin - Part 25: More Nullables | Ray Wenderlich

Learn how to unwrap Nullables, force unwrap Nullables, and use the let statement.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4736-programming-in-kotlin/lessons/25

Can u explain the let syntax?i am not able to understand the syntax of let function

The let function is used on nullable variables. It allows you to safely use the variable in other calls.
For example:
var name: String? = β€œMy Name”
name?.let {
it.toLowerCase()
}

you can also give β€œit” a name:
name?.let { nonNullableName β†’
nonNullableName.toLowerCase()
}