Programs often need to take one action in certain cases, and different actions in different cases.
Also, programs often need to repeat actions multiple times.
These two ideas are called control flow.
table by: https://generalistprogrammer.com/cheatsheets/godot-gdscript
| Code | Description | Example |
|---|---|---|
| if condition: | condicional statement | |
| for i in range(n): | loop n times | |
| for item in array: | Iterate over array | |
| while condition: | while loop | |
| match value: | Pattern matching (switch statement) | |
| break | exit loop early | |
| continute | Skip to next iteration |