Syntax error there, you are missing the ?

name?.let { name ->
//...
}

You have option to do

name?.let {
} ?: Kotlin.run {
//... deal with the null value here
}

But it doesn’t feel natural, feel forced. I usually just fall-back to old school null check

if (name != null) {
} else {
}

Hiring Android engineer shorturl.at/bivJO Clean coder, walker & biker. Hater of inefficiency

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store