Variables in Programming: How Students Can Understand the Way Computers Store Information
Knowledge Hub Insights Blog

Variables in Programming: How Students Can Understand the Way Computers Store Information

Nov 18, 2026 marketing m 3 min read

Imagine playing a game where the score increases every time you complete a challenge. The computer needs to remember the current score, update it when you earn points and use the new value as the game continues.

But how does a program keep track of this changing information?

The answer is variables in programming.

Variables are one of the fundamental concepts in computer science. They help programs store information, retrieve it and update it whenever needed. Understanding how variables work gives students an important foundation for learning coding, logical thinking and computational problem-solving.

What Are Variables in Programming?

A variable is a named storage space that a computer program uses to hold information.

Think of it as a labelled container. The label identifies the information, while the value inside the container can change as the program runs.

For example, a student might create a variable called score to store the points earned in a game.

Initially:

score = 0

After completing a challenge:

score = 10

The variable name remains the same, but its value changes.

This allows the program to remember the latest information and use it when executing instructions.

How Do Variables Work in a Program?

Variables work by storing information that a program can access whenever required. When an instruction changes a variable's value, the program uses the updated information in subsequent operations.

Consider a simple robot challenge.

A student programs a robot to complete different tasks. The program needs to keep track of how many tasks the robot successfully completes.

  • The starting value is 0.
  • The robot completes its first task, and the score becomes 10.
  • It completes another task, and the score increases to 20.

The variable stores the changing score throughout the activity.

This simple example demonstrates how programs use variables to manage information and respond to different actions.

Why Are Variables Important in Learning Computer Science?

Variables allow students to move beyond simply giving instructions to understanding how programs manage information.

They help students explore several important programming concepts:

1. Storing Information

Students learn how programs keep track of information such as scores, names, numbers and other data.

2. Updating Values

They understand that information does not always remain the same. A variable can change whenever an instruction requires an update.

3. Using Information in Instructions

Students discover how stored values can influence what happens next in a program.

4. Developing Logical Thinking

Working with variables encourages students to understand relationships between information, instructions and outcomes.

These concepts provide a foundation for exploring more advanced programming ideas.

How Can Students Learn Variables Through Hands-On Activities?

One effective way to introduce variables is through practical challenges that connect programming concepts with familiar situations.

For example, students can create a simple scoring system for a game or program a robot to track completed tasks.

They can experiment by changing values, running instructions and observing how those changes affect the outcome.

With LEGO® Education Computer Science & AI learning experiences, students can explore programming concepts through hands-on activities that connect abstract ideas with practical problem-solving.

Rather than simply memorising definitions, students get opportunities to investigate how programs work, test their thinking and understand the role of information in programming.

Building a Foundation for Future Programming Skills

Understanding variables is an important step in learning how computers process information.

As students progress, they can apply this knowledge when exploring conditions, loops, calculations and more complex programming challenges.

The ability to understand how information is stored, updated and used helps learners develop computational thinking and problem-solving skills.

Every program works with information. Variables give that information a place to live.

By exploring variables through practical Computer Science activities, students begin to understand not just how to write instructions, but how programs think and work with changing information.

Have Questions?
Get in Touch With Us.

knowledge-hub form
Share This