# Control Flow

> The order a program runs its steps in. Ifs skip lines; loops repeat them.

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** Flow of Control

## Think of it like

Think of it like a board game. Most turns you move ahead, but some squares send you back or let you skip.

## Definition

Control flow is the order in which a program runs its steps. By default it goes from top to bottom, one line at a time. Ifs let it skip some lines, and loops make it repeat others. Calling a function makes it jump to that function and then come back. Reading code well means following this path, not just reading lines.

## Example

A quiz app asks a question, then jumps to the right or wrong screen. Then it loops back for the next question.

## Why it matters

Without control flow, a program could only run every line once, in order. Choices and repeats come from here.

## Common mistake

Reading code top to bottom like a book. The real order follows the ifs, loops and calls.

## Three principles

- **Top to bottom first.** Lines run in order unless told otherwise.
- **Choose and repeat.** Ifs pick a path; loops go round again.
- **Jump and return.** A function call goes away and comes back.

## Related terms

- [Conditional Statement](https://learn.benibix.com/term/development/conditional-statement)
- [Loop](https://learn.benibix.com/term/development/loop)
- [Function Call](https://learn.benibix.com/term/development/function-call)
- [Statement](https://learn.benibix.com/term/development/statement)
- [Control Flow Graph (CFG)](https://learn.benibix.com/term/development/control-flow-graph)

## Taught in

- [If, Else and Match](https://learn.benibix.com/learn/development-concepts/if-else-and-match): Programming Basics, 10/18

---

Source: https://learn.benibix.com/term/development/control-flow
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
