What Is “Variables” in Programming

Hello everyone! 😊
Today, we’re going to talk about one of the most essential concepts you must understand when learning to program — the variable.

Concept illustration for variables

Programming is, at its heart, a process of executing logical steps in sequence. During that process, a computer needs to remember certain values and retrieve them when necessary to perform calculations. Some of these values are created while the logic runs, and others can change in the middle of execution.

For example, imagine you initially have a score of 90 points. Later, you discover a grading error and add 10 more points — now it’s 100. A program constantly remembers such “current states” and updates them into “new states.”

So, how does a computer store and manage these pieces of information? That’s where variables come in. A variable is a small storage space where a program can temporarily keep the values it needs to remember.

To make this easier to visualize, think of a variable as a mailbox. Inside the mailbox, we can store letters — pieces of information we may need later. Whenever we want, we can open it, read what’s inside, or replace it with a new letter.

In other words, a variable is a labeled storage box for data. A program isn’t just a rigid sequence of commands — it’s a structure that stores, modifies, and reuses information as it runs.

Mailbox analogy for variables

🏠 A Variable Is Like a Mailbox

When we write code, we’re giving the computer a set of logical instructions to follow. During that process, we often need to temporarily remember certain values.

For instance, if your logic says “Increase the score by 10,” you first need to store the current score somewhere. That storage space is the variable.

Here’s how it might look in pseudo code:

score = 90          ← Store the current score.
score = score + 10  ← Retrieve the previous score, add 10, and store it again.

Here, score is the name of the mailbox, and the number 90 is the letter (value) we’ve placed inside. The value may change, but the name tag (score) remains — so we can always look it up again later.

Thus, a variable is a named memory space. It exists while the program is running and disappears once the logic ends.


🧭 Why We Use Variables

In the early days of computing, variables didn’t have names. Data was stored directly in memory addresses — like giving an order that says, “Put 7 in location 103.”

But this method was difficult for humans to understand and prone to mistakes. So programmers thought, “Wouldn’t it be easier if we used names instead of raw addresses?” That’s when they started using human-readable names to represent memory locations.

This is the core idea of modern variables: A variable is a label that helps humans handle memory more easily — a kind of address tag.


⚙️ How a Variable Works

Technically, when we declare a variable, we’re telling the computer,

“I want to reserve one slot in memory under this name.”

Let’s look at an example in pseudo code:

age = 15
age = age + 1

We can interpret this step by step:

  1. Reserve one slot in memory.
  2. Create a mailbox in that memory space.
  3. Give the mailbox the name age.
  4. Store the value 15 inside the age mailbox.
  5. Retrieve the value from age, then add 1.
  6. Store the new result back into the age mailbox.

Ultimately, a variable is a space that allows storing, retrieving, and updating values. The contents may change, but the name remains. That’s why even in large programs, you can easily understand what data you’re working with just by reading variable names.


✏️ Thinking Practice for Beginners

  1. Track how values flow.
    As your code runs, imagine how each value changes step by step. This habit helps you see the overall flow of your program at a glance.

  2. Give meaningful names.
    Variable names should be short but descriptive. Instead of using a, choose names like total, score, or count. It makes your code far easier to read later.

  3. Don’t confuse names and values.
    A variable is the label, and the value is the content. Changing the label doesn’t alter the content, and replacing the content doesn’t change the label.


🧩 Summary

A variable may seem simple, but it’s one of the most fundamental and powerful concepts in programming. That’s because every program is, at its core, a process of storing, changing, and using values.

Once you understand variables, you’ll find it much easier to learn more advanced ideas like conditions, loops, and functions. A variable isn’t just a box — it’s the centerpiece that connects your logic together.


Today, we explored the idea of variables using the mailbox analogy. It might feel abstract when reading, but try visualizing the situation in your mind or writing a small example on paper — it’s the fastest way to truly understand.

Think of simple situations like “adding a score” or “storing a name,” then create the necessary variables yourself. Write them out, change the values, and observe how they behave. By actively experimenting, you’ll make the concept your own.

In the next article, we’ll look at constants — how they differ from variables, and when to use one or the other in real programming.

Thank you so much for reading. Wishing you a happy coding journey! 🌸

You can view the original blog post in Korean at the links below:

View in Korean