# Variable

> A named box in a program that holds a value. The value can change.

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

## Think of it like

Think of it like a box with a name on the lid. You can put something in, look inside, or swap it.

## Definition

A variable is a name that holds a value in a program. You pick the name, like score or price, and give it a value. Later you use the name instead of the value. The value can change while the program runs, which is why it is called a variable. Good names make code much easier to read.

## Example

A game keeps the player's points in a variable called score. Each coin adds 10, so score goes 0, 10, 20.

## Example code

```python
>>> score = 0
>>> score = score + 10
>>> score
10
```

The box called score starts at 0. One coin later it holds 10.

## Why it matters

Programs remember things in variables. Without them, a program could not keep a score, a name or a total.

## Common mistake

Picking names like x or data2. A name like total_price tells the next reader what is inside.

## Three principles

- **A name and a value.** The name points to what is stored.
- **Can change.** A new value can replace the old one.
- **Name it well.** Say what is inside, not just a letter.

## Related terms

- [Constant](https://learn.benibix.com/term/development/constant)
- [Assignment](https://learn.benibix.com/term/development/assignment)
- [Data Type](https://learn.benibix.com/term/development/data-type)
- [Scope](https://learn.benibix.com/term/development/scope)

## Taught in

- [Variables and Assignment](https://learn.benibix.com/learn/development-concepts/variables-and-assignment): Programming Basics, 5/18

---

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