Day160 — Return a value from a kotlin coroutine scope
Return value within a coroutine scope
Return value outside a coroutine scope
Use invokeOnCompletion
when it is really necessary because it has no difference from “Return value within a coroutine scope” with a CoroutineExceptionHandler
to me. And it disrupts the coroutine pattern by introducing a callback.
They do the same thing. I prefer the first one, handling everything within a coroutine scope.
These two are the same.