6 concepts · 10 practice questions
A suspend function can pause and resume without blocking its thread. The compiler adds a hidden Continuation parameter; it can only be called from a coroutine or another suspend function.
suspend fun loadProfile(): Profile {
val user = api.fetchUser() // suspends, thread is free
return Profile(user)
}
Sign in to read the rest and take the 10-question test.
Sign in to continue