elye
12/13/2017, 12:58 AMdiesieben07
12/13/2017, 12:59 AMvariable?.let { doSomething(it) } ?: doOtherThing()
But I don't think this is a good idea. It's hard to read and follow. There is nothing wrong with an if-expression.umar
12/13/2017, 4:26 AMTrue, if one has a hammer, all problems look like nails.
(googled translation of the russian proverb)
You don't have to use null safe access operator to control workflow.
And never use the ?:
operator after let
. It may broke your code if let
returned null
.
I regularly see this question, is this case that common?