There no version of `also` that ignores the receiv...
# announcements
k
There no version of
also
that ignores the receiver, right? Something that fits here:
Copy code
return call().ignore{ //no it or this here }
k
What will be the purpose then?
d
return try { call() } finally { ... }
maybe?
k
return run { call(); /* more stuuff */ }
k
@kingsley Specifically to run some code just before returning.
k
Well. You could just use
apply
or
also
and ignore the receiver
k
Yea I was doing that but the I wondered if there was a better way.
k
Or well. Create your own extension function
d
How about:
Copy code
val result = call()
// do stuff
return result
Nothing wrong with locals 😉
k
My code if flooded with `result`s already ☺️
k
Copy code
inline fun <T> T.ignore(block: () -> Unit): T {
  block()
  return this
}
k
I'll probably settle for something like that indeed.
i
You can use
also
and ignore the parameter naming it with
_
placeholder:
Copy code
call().also { _ -> .... }