In short now. In long, first off these aren't dele...
# android
k
In short now. In long, first off these aren't delegates (Kotlin has a concept named delegates so let's keep the nomenclature correct). Let is just an extension function on any non-nullable type that will bind the receiver into the lambda parameter and evaluates to whatever your lambda returns. The idiomatic
x?.let {}
construct uses that combined with the safe-call operator
?.
to only invoke the
let
on a non-null receiver. If the receiver is null, the safe-call evaluates to null so you can use the elvis operator to continue chaining.