Coroutine

Coroutine

Coroutines are computer program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks, iterators, infinite lists and pipes.

The term coroutine was originated by Melvin Conway in a 1963 paper.

Read more about Coroutine:  Comparison With Subroutines, Comparison With Generators, Common Uses, Programming Languages With Native Support, Alternatives and Implementations