Hey guys, do we need to await for the result retur...
# getting-started
a
Hey guys, do we need to await for the result returned by a suspended function ?
Copy code
runblock {
val result =  methodCall(). // this method is suspended 

repository.persistResultToDB(result)
}
so, the
methodCall()
do we need to await for its completion, to be able to use the returned
result
to persist them to the db ?
h
if the
persistResultToDB()
method is also suspend so it will naturally waits for the result value. Because they are in the same coroutine scope
j
No matter what
persistResultToDB
is, you don't need to await a suspend function when you call it, it returns the value directly and you can use it
a
the
persistResultToDB
is not suspended !
j
@Ahmed it doesn't matter, calling
methodCall()
directly and using the return value is correct
1
a
Perfect! Thanks a lot