Coroutines
A coroutine is work that can pause and resume at the point where it left off. Use one when several activities need to take turns in the same VM.
Pause between two messages
Each resume runs until a yield or the final return.
use task
func steps():
yield 'first'
return 'second'
step = create(coroutine, steps)
print(task.resume(step))
print(task.resume(step))
first
second
The first resume pauses at yield. The next resume completes the function.