ontherunvaro
12/20/2017, 9:49 AMvariable?.let{...}
or if (variable != null) {...}
?groostav
12/20/2017, 9:50 AMvariable
is a local stack variable, I'd go with option 2 since its brain dead. If variable
is a field, option 1 is more elegantontherunvaro
12/20/2017, 9:51 AMgroostav
12/20/2017, 10:46 AMif(x != null){ doStuff(x) }
means?.let {
is simply a kotlin-specific thing, ergo you need to be more comfortable with the language to understand it