Ayla
10/18/2023, 12:29 AMVampire
10/18/2023, 12:52 AMephemient
10/18/2023, 12:53 AMfun foo(x: Int?) {
val x: Int = x ?: default
the x
on the right-hand side refers to the x
from the outer scope, the left-hand side x
doesn't exist yet.Vampire
10/18/2023, 12:53 AMephemient
10/18/2023, 12:53 AMval x = run { x }
val obs = object : () -> Unit {
override fun invoke() {
signalApplyCallback = this
}
}
note that the name obs
still isn't bound yet, but you can refer to the lambda itself as this
Ayla
10/18/2023, 1:09 AM