# The Execution Loop

In osl you can define what runs each frame using the placement of the "mainloop:" label. This label defines what line to jump to for each frame of the script.

Everything placed before the mainloop label will be run only on the first frame/when the app opens, and everything after it will be run every frame.

```javascript
log "onload"
// gets logged only on the first frame of the apps execution

mainloop:
log "mainloop"
// gets logged every frame
```

## for dummies

everything before the line, "mainloop:" gets run when the app is opened

everything after the line "mainloop:" gets run every frame

:3


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://osl.mistium.com/basics/the-execution-loop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
