If you have a conditional without an else, it does...
# getting-started
p
If you have a conditional without an else, it doesn't make a ton of difference. But to elaborate on what I was saying before, there is a difference between if/else and
?.let { ... } ?: ...
.
Copy code
val foo: String? = null

val bar = foo?.let { thingThatCouldReturnNull() } ?: "Hello"
val baz = if (foo == null) thingThatCouldReturnNull() else "Hello"

println(bar) // prints "Hello" if thingThatCouldReturnNull() returns null
println(baz) // prints "null" if thingThatCouldReturnNull() returns null