What is a Variable?

In programming, can think of a variable as a storage location for stuff. It may contain a known or unknown value, but you’ll be able to call this information up whenever you need it with a specified ‘word’.

For instance, if you arrived at makerclub.org and we wanted to ask your name, because we’re friendly like that,  we would get a little text box on the screen to ask what you name is. We might call this box ‘Yourname’ – when you put your name in the box, I could then ‘call’ up your details at anytime by using the ‘Yourname’ variable that I had created.

Variables are one of the most important concepts to understand in programming, storing and then calling up information is what every website is based on. Variables mean that programmers don’t have to actually write in all the data themselves, they can instead use variables to represent it.

Every variable has a name and a data type. A variable’s data type indicates what sort of value the variable represents, such as whether it is an integer, a floating-point number, or a character. Click on the links to find out more about these.

The opposite of a variable is a constant. Constants are values that never change. Because of their inflexibility, constants are used less often than variables in programming.

Like most things in programming, it’s difficult to explain, but quite easy to do. If you really want to get to grips with programming, design or electronics, take one of our MakerClub courses. They are easy to learn, fun to build and you’ll get the building blocks you need to create your own connected products.

Join The Maker Movement