Coroutines are functions that can pause themselves and then get resumed, picking up where they left off, retaining access to any local variables and closures they may have had. They have a lot of uses but they're particularly great at modeling the kinds of state machines you end up writing in a lot of video game and interactive software.

Modern languages generally do not support coroutines directly but they can usually be recreated by taking advantage of generators or async/await semantics. Unity leveraged C#'s enumerators and yield syntax for their coroutine system, and Ajeeb uses JavaScript's function* syntax to do something similar.

This site is a collection of examples of coroutines doing cool things. All the examples use the Ajeeb coroutines, Pixi.js for graphics and free assets from Kenney. They are editable so play around and have fun.

Made by your pal Ramsey who won't shut up about coroutines.