Search your topic here

coroutines ppl


To understand coroutines first we should know about subroutines.
In computer programming, a subroutine is a sequence of program instructions that perform a specific task. For example a program for addition, subtraction. Subroutines is also known as function.
Coroutines are generalizations of the subroutines.
A subroutine has the same starting point and the same endpoint all the time, while a coroutine has multiple entry points for suspending and resuming execution. Coroutines are cooperative, that means if a coroutine consume input data, another coroutine can consume it, and another coroutine can be used to display the output.
Coroutines are nothing but cooperative functions.