This is, in effect, "hello, world" in the realm of coroutines. If you run this, you will see one message printed immediately and the other after a short delay.
There are five main elements when working with coroutines:
CoroutineScope, such as the
GlobalScopethat is used here
A coroutine builder, such as the
Dispatchers, such as
suspendfunctions, for marking code that can be suspended safely so other code can run
CoroutineContext, such as the one created via
withContext(), to change which dispatcher should be used for some code
All of these will be explored in upcoming lessons.