stevecstian
03/17/2020, 9:18 AMAny?
, not Unit
, right?Manuel Vivo
03/17/2020, 9:45 AMUnit
, there’s nothing to returnManuel Vivo
03/17/2020, 9:47 AMcompletion
param is used to “return” a valuestevecstian
03/17/2020, 9:51 AMcompletion
seems not the only way to "return" value...Manuel Vivo
03/17/2020, 9:54 AMsuspendCoroutine
jw
03/17/2020, 1:49 PMAny?
as a return type because it's a union type of T | COROUTINE_SUSPENDED
jw
03/17/2020, 1:51 PMsuspend fun foo(): String {
return if (Random.nextBoolean()) {
4
} else {
otherSuspendFunction()
}
}
to return synchronously when it can. Synchronous exceptions behave similarly.Manuel Vivo
03/17/2020, 2:28 PMaraqnid
03/17/2020, 3:54 PM