Fish Touching🐟🎣

Coroutine

Apr 29, 2023

A coroutine is a computer program component that allows execution to be suspended and resumed, generalizing subroutines for cooperative multitasking
In other words, a coroutine is a function that can be paused and resumed at specific points, allowing other code to run in the meantime.

# Coroutine vs Thread

Coroutines are similar to threads, but they are not the same thing. Threads are managed by the operating system and can run in parallel on multiple processors, while coroutines are managed by the program and run on a single thread