Bridge Concepts Beginner

What Is a Variable?

A variable is a named box that holds information in a program.

Download the poster

A variable is a place with a name that stores a value. Think of it like a labeled box: this box has a name, and you can find what is inside it later.

You see the same idea in real life: a name tag, a labeled toy box, a score counter, or a backpack with a name on it. Put a label on something, and you can find it again.

Computers use variables to store all kinds of information. For example, score = 10, name = "Sam", lives = 3, or color = "blue". Giving each one a name means the program can use it later.

Why do they matter? Variables help programs remember things, change them, and make choices.

Here is a real example. In a game, your points start at 0. You score, and now it is 5. You score again, and now it is 10. The points are a variable, and its value keeps changing.

Remember: variables have names, they hold values, and the value can change.

What to remember

  • A variable is a named box that stores a value.
  • The name lets a program find it again later.
  • The value inside can change as the program runs.
  • Variables help programs remember things.

Words to know

Variable
A named place that stores a value.
Value
The information stored inside.
Name
The label used to find the variable.
Assign
To put a value into a variable.

For grown-ups

A variable is a named binding to a value in memory that a program reads and updates as it runs. It is one of the first building blocks of coding, names, values, and change, and pairs naturally with algorithms: the algorithm is the steps, the variables hold the state those steps work on.

Want the full story? These go deeper: