xii
02/11/2022, 4:17 PMxii
02/11/2022, 4:20 PMsuspend fun returnVal(){
anotherClass.checkSomething()
return "hello"
}
check something looks like something like this:
suspend fun checkSomething(){
if (asyncFunction()){
throw Exception()
} else {
return
}
}
and lastly,
suspend fun asyncFunction(){
return anotherAsync.await() == false
}xii
02/11/2022, 4:20 PMVampire
02/11/2022, 4:50 PMcheckSomething() as it is a Unit function.
await() is a function on Deferred.
And yes, as you await anotherAsync, asyncFunction will not complete until it is finished and thus checkSomething will not complete earlier either.xii
02/11/2022, 5:19 PMxii
02/11/2022, 5:19 PM