Coroutines: Structured Concurrency

Sequential invocation

Each line within the lambda is run sequentially. This means if one function call is blocking, the whole coroutine is suspended and waits until the suspended function is finished.

Nested Coroutines

Coroutines are able to be nested. This allows you to be able to trigger multiple lines of asynchronous code to start running. An example of where this is useful is activating different events to occur on the completion of a purchase.

Parent-Child Coroutines

Parent coroutines will continue to follow it's own line of code. It will not wait until child coroutines finish before continuing the next line. Child coroutines will run independently.