coroutine
coroutine name cmd ?arg ...?
Makes a command name and runs cmd until its first yield. The value of that yield is the result of coroutine. Each call of name goes on to the next yield, and its argument is the result of that yield. The coroutine ends when cmd returns.
Examples
A click on an example runs it in the shell of the page.
coroutine gen apply {{} {yield 1; yield 2; return 3}}:1gen:2
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.
Differences from Tcl 8.6
- The WebAssembly builds have no
coroutinein this version: the error is "coroutine is not available on this target".