Coroutine Scope Functions

Learn about the coroutine scope function.

Imagine that we need to concurrently get data from two (or more) endpoints in a suspending function. Before we explore how to do this correctly, let’s see some suboptimal approaches.

Approaches used before coroutine scope functions

The first approach is calling suspending functions from a suspending function. The problem with this solution is that it’s not concurrent (for example, if getting data from each endpoint takes one second, a function will take two seconds instead of one).

Get hands-on with 1200+ tech skills courses.