# Event loop: how scripts take turns [Concepts explained](README.md) An **event loop** is a way to organize work that becomes ready over time. In Pliro, event scripts may start because the program starts, a timer finishes, or an input event arrives. A **queue** is a waiting line. **FIFO** means *first in, first out*: ready work joins the back and takes its turn from the front. ## Waiting gives another script a turn ```pliro # language: en when started(): say "A" wait(0.02) say "B" when started(): say "C" ``` The output order is `A`, `C`, `B`. The first script waits, so the second ready script can run. After the waiting time, the first can continue. Pliro uses **cooperative scheduling**: scripts give other work a chance at defined places. A **checkpoint** is such a place. Waiting with a positive duration is one example. This is not a promise that every source line runs at the same time as other scripts. ## Time and state Twenty milliseconds is 0.02 seconds. A timer becoming ready does not guarantee execution at that exact instant; other work and the host affect when it continues. Scripts can share global variables. Check what another script may change while yours is waiting. Avoid long loops that never give other work a turn; execution budgets can stop a runaway program. [Event rules](../guides/events.md) · [State](../guides/state.md) · [Execution limits](../guides/limits.md)