# Break Statement

> A line that stops a loop at once. Its partner continue skips to the next pass.

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** break, continue, Break and Continue

## Think of it like

Think of it like a search for lost keys. Once you find them, you stop looking in the other rooms.

## Definition

A break statement ends a loop at once, even if items are left. The program carries on with the first line after the loop. Its partner, continue, skips only the rest of this pass and moves to the next one. Both usually sit inside an if. They save work when the answer is found early.

## Example

A search loops over 10,000 users looking for one email. It finds it at user 12 and breaks, so it never checks the other 9,988.

## Example code

```python
for n in [4, 9, 2, 7]:
    if n == 2:
        print("found 2")
        break
    print("checked", n)
```

It checks 4 and 9, finds 2, then stops. It never looks at 7.

## Why it matters

Stopping early can save a lot of time on long lists. It is also the clean way out of a loop meant to run forever.

## Common mistake

Expecting break to leave every loop at once. In nested loops it only leaves the one it sits in.

## Three principles

- **Break ends it.** The loop stops right there.
- **Continue skips one.** Only the current pass is cut short.
- **Inner loop only.** It leaves the closest loop, not all of them.

## Related terms

- [Loop](https://learn.benibix.com/term/development/loop)
- [For Loop](https://learn.benibix.com/term/development/for-loop)
- [Infinite Loop](https://learn.benibix.com/term/development/infinite-loop)
- [Conditional Statement](https://learn.benibix.com/term/development/conditional-statement)

## Taught in

- [For and While Loops](https://learn.benibix.com/learn/development-concepts/for-and-while-loops): Programming Basics, 11/18

---

Source: https://learn.benibix.com/term/development/break-statement
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.
