Atom

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.

Atom
use task

func steps():
    yield 'first'
    return 'second'

step = create(coroutine, steps)
print(task.resume(step))
print(task.resume(step))
Output
first
second

The first resume pauses at yield. The next resume completes the function.