# next
Alias for `resume` — advance a suspended coroutine/generator and return the next
yielded value. Use it to drive `spawn`ed coroutines or `defcoro`/`@generator`
functions one step at a time.
## Syntax
[next $gen]
## Parameters
- `$gen` — A coroutine value (from `spawn`, `defcoro`, or `@generator`).
## Examples
def gen [spawn {|| [yield :a] [yield :b] }] [next $gen] # → :a [next $gen] # → :b [next $gen] # → nil (finished)
## Returns
The value yielded by the coroutine, or its final result when the body completes;
nil once the coroutine is done or when `$gen` is not a coroutine. Resuming an
already-finished coroutine keeps returning nil.
## See Also
`resume`, `spawn`, `yield`, `coro-state`, `defcoro`