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
There's a nice, little lib that allows for writing let-like code with multiple variables. It's open-source and you can find it on GitHub, it's called Unwrap
Example based on readme:
unwrap(_a, _b, _c) { a, b, c ->
println("$a, $b$c") // all variables are not-null
}
All unwrap(...) methods are marked inline so there should be no overhead with using them.
By the way, this lib also allows to handle situation when there are some null variables (the nah() method).