I wonder what is the best way to handle such scenario
class Person(var name:String? = null, var age:Int? = null){ fun test(){ if(name != null &am
For the cast to be possible you have to make a local copy of the value somehow. In Kotlin this is best done explicitly:
val name = name val age = age if(name != null && age != null){ doSth(name, age) }
The let function hides this behind an abstraction layer, which is not the best IMHO.
let