What is a coroutine? How are they related to concurrency?
I find most of the answers too technical even though it is a technical question. I had a hard time trying to understand the coroutine process. I kind of get it but then I don't get it at the same time.
I found this answer here very helpful:
https://dev.to/thibmaek/explain-coroutines-like-im-five-2d9
To quote from Idan Arye:
To build on your story, I'd put it something like this:
You start watching the cartoon, but it's the intro. Instead of watching the intro you switch to the game and enter the online lobby - but it needs 3 players and only you and your sister are in it. Instead of waiting for another player to join you switch to your homework, and answer the first question. The second question has a link to a YouTube video you need to watch. You open it - and it starts loading. Instead of waiting for it to load, you switch back to the cartoon. The intro is over, so you can watch. Now there are commercials - but meanwhile a third player has joined so you switch to the game And so on...
The idea is that you don't just switch the tasks really fast to make it look like you are doing everything at once. You utilize the time you are waiting for something to happen(IO) to do other things that do require your direct attention.
Definitely check the link, there are much more that I cannot quote everything.