Jul 20, 2017 · 1 min read
I would rather write the let example like this:
person?.let {
// person object is not null in here
it.name = "Tony Stark"
}Here, no smart cast is needed: the person argument passed to the let block (it) is non-null. Also, using a property instead of a setter.
