0
Doing somethig else and returning if null in one expression
Is there anyway to reduce this line of code anymore because I don't appreciate the "smart cast" hint. return foo().let { if(it == null) { //Do something else otherValue } else it }
2 odpowiedzi
0
not that I'm aware, you could use a switch if that exists in kotlin but I don't think it would be better. Don't take my word I'm just answering because no one did. I hope you figured it out by now, its been 1 year...
0
thomas bouasli the switch would give the same warning