What is a Variable?
I mean it varies. But what else? What is a constant?
Variables are vital for us in any modern programming language. But what exactly is a variable, and can we make an analogy for people reading this article? I say yes, on both counts.
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- None, but for practical purposes it would be useful to be able to produce a “Hello, World!” application in your chosen programming language
Terminology
Variable: A named value, that potentially can be changed as the program runs
Variable name: A label for a memory location
Data: Information processed or stored by a computer
Storage: A place where data can be stored
Program: A computer program is a set of instructions to perform a task on a computer
Reference: A pointer to a variable or object
Declaration: Announcing a variable (usually) at the beginning of a program
Naming convention: A set of rules about the names of variables
Value: The something that would be stored in a variable