Sometimes, we may have several suspended functions and we want to have a single piece of logic that operates on the results of the suspended functions as they complete. In other words, we want a single piece of logic that can work across one or more suspendable functions. The coroutines library provides this capability through the select function.
The select function acts as a type-safe builder, where extension functions are provided that can register callbacks on the suspendable functions. These extension functions are available on instances of Channel and Deferred. We will take a look at both in this section.