# Flow control

> Branches, loops, jumps, returns and state changes in LSL.

:::caution[Stub]
This documentation page is a stub and is currently under development.
:::

The syntax below is from the [LSL definitions](/controls/).

| Construct | Syntax |
| --- | --- |
| [`if`](/controls/if/) / [`else`](/controls/else/) | `if (<condition>) { ... } else { ... }` |
| [`for`](/controls/for/) | `for (<initializer>; <condition>; <post-iteration-statement>) { ... }` |
| [`while`](/controls/while/) | `while (<condition>) { ... }` |
| [`do`](/controls/do/) | `do { ... } while (<condition>);` |
| [`jump`](/controls/jump/) | `jump <label>` |
| [`return`](/controls/return/) | `return [<variable>];` "Leave current event or function." |
| [`state`](/controls/state/) | `state <target>` "If the target state is not the same as the current one, change to the target state." |

## Reference

- [All flow control](/controls/)
- [States and events](/fundamentals/states-and-events/)
- [Operators](/fundamentals/operators/)

---

From lsl.dev: https://lsl.dev/fundamentals/flow-control/
