`let` is useful if you don't want to define a vari...
# language-proposals
k
let
is useful if you don't want to define a variable and just use it within the scope of the block you're passing to
let
. Example: Normally you'd do:
Copy code
val foo = lookupFoo()
if (foo != null) {
    foo.doThing()
}
It's cleaner to do
lookupFoo()?.let { it.doThing() }
No variable needed to be defined