robin
02/22/2017, 12:05 PMval unwrapped = optional
if(unwrapped != null) { doSmth() }
else { doSmthElse() }
mg6maciej
02/22/2017, 12:09 PMrobin
02/22/2017, 12:10 PM?.let
notation is only preferrable to an old-fashioned null check if the variable in question is non-local so you need an immutable local copy and you don't need an else-branch, imo.Andreas Sinz
02/22/2017, 12:26 PMdoSometh()
returns null, doSmthElse()
will be called toorobin
02/22/2017, 12:28 PM