# Expression

> A piece of code that works out to one value, like 3 + 4.

**Field:** Software Development  
**Category:** Programming Concepts

## Think of it like

Think of it like a sum on a calculator. You type 3 + 4, and it gives back one answer.

## Definition

An expression is a piece of code that works out to a value. 3 + 4 is an expression, and its value is 7. A name of a variable is an expression too, and so is a question like age > 10. The computer works out the value, then uses it. Expressions often sit inside statements, the way a sum sits inside a sentence.

## Example

In price * 2, the computer looks up price, doubles it and gets 20. That 20 is the value of the expression.

## Example code

```python
>>> 3 * 4 + 2
14
>>> 10 > 3
True
```

Each line works out to one value: a number, then True.

## Why it matters

Most of what a program computes happens inside expressions. Reading them well is reading what the code really does.

## Common mistake

Thinking an expression changes things by itself. It only works out a value. A statement has to use it.

## Three principles

- **Gives a value.** Every expression works out to one result.
- **Can nest.** Small expressions build bigger ones.
- **Lives in statements.** A statement uses the value it gives.

## Related terms

- [Statement](https://learn.benibix.com/term/development/statement)
- [Operator](https://learn.benibix.com/term/development/operator)
- [Variable](https://learn.benibix.com/term/development/variable)
- [Data Type](https://learn.benibix.com/term/development/data-type)

## Told apart from

- [Statement vs Expression](https://learn.benibix.com/compare/statement-vs-expression): A statement does a job, like storing a value. An expression only works out a value, and a statement then uses it.

## Taught in

- [Statements and Expressions](https://learn.benibix.com/learn/development-concepts/statements-and-expressions): Programming Basics, 3/18

---

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