Does return from Kotlin use lambda close the resou...
# getting-started
d
Does return from Kotlin use lambda close the resource? Usually returning from a lambda is without a
return
, so am I returning from the outer function bypassing the
use
?
Copy code
fun doSomething(): Boolean =
resource.use {
   if (condition) return false
}
d
use
uses try-finally under the hood, so there is no way to exit from
use
that does not close the resource.
d
Thanks 👍🏼!