This takes the previous sample and divides it into two separate coroutines, each slated to be run on Dispatchers.Main.

If you run this sample, you get very different results from the previous one. While an individual coroutine executes its statements sequentially, separate coroutines can execute their statements in parallel. When a coroutine reaches a suspend function, work on that particular block of code can be suspended while waiting for the suspend function to complete. So, when you run this sample, both "before" messages are printed right away, as Kotlin switches to the second coroutine when it reaches the call to startForTime() in the first coroutine.

You can learn more about this in:
Run Edit