Home » Unit 3: Information 1: Concept of Variables

Concept of Variables

💡 Understanding Variables — Let’s Get Familiar!

Before jumping into the Snap! projects on variables and the European Monetary Union, let’s take a moment to understand the concept of variables.

🧠 What are Variables?

Variables are a core concept in Computer Science, and they help us store and manage data in our programs. Think of variables as storage containers where we can keep information. Each variable has a unique name, and we can store a value in it.

These values aren’t limited to just numbers. You can store all sorts of data, like:

  • Words 📝

  • Characters 🔤

  • Images 🖼️

  • Even commands 🛠️!

The great thing about variables is that you can access their values anytime, and you can even change them while the program is running!

📦 A Simple Analogy: Variables as Drawers

Imagine that variables are like drawers in a large cupboard. Each drawer has a unique label to help you easily find it. You can:

  • Put something in the drawer 🏷️

  • Check what’s inside 👀

  • Modify its contents 🔧

  • Or replace what’s in it entirely 🔄


💰 Example: The Bank Account Drawer

Let’s say you have a drawer labeled "bank account". At the start of your program, you assign it a value of 100€ — this means there are 100€ in your bank account.

  • Later, you receive a 50€ payment.

  • You check the "bank account" drawer to see what’s inside — 100€.

  • Then, you add 50€ to the amount already in the drawer, making it 150€.

  • Now, when you open the "bank account" drawer again, you’ll find the updated value: 150€!

You can continue to modify and use this variable throughout the program for different purposes. 📊


📝 Summary:

  • Variables store data with a unique name.

  • You can access, modify, and replace the data inside a variable at any point.

  • The drawer analogy makes it easy to visualize how variables work!

Ready to dive into the Snap! projects and apply your understanding of variables to the European Monetary Union? Let's go! 🚀

Feedback

We appreciate your feedback! It helps us continuously improve our course materials.