# defcoro Define a coroutine. ## Syntax
defcoro name { |params| body }
## Examples
defcoro counter {|limit|
    for i [range $limit] {
        yield $i
    }
}

set c [counter 5]
echo [next $c]    # 0
echo [next $c]    # 1
echo [next $c]    # 2
## Notes - Use `yield` to produce values - Use `[next $coro]` to get the next value - Coroutine suspends at each `yield` and resumes on next `next` call ## See Also `yield`, `next`