GlossaryFundamentals

What is a variable?

A variable is a named container that holds a value your code can read and change later.

A variable is the simplest building block in any program. You give a piece of information a name, and from then on, your code can refer to it by that name. Behind the scenes the computer keeps track of where the value is stored, but you do not have to think about that part.

Variables matter because real software juggles a lot of moving pieces. A signup form might track the user's email, their plan choice, and whether they agreed to the terms. Each of those is a variable. Code reads them, updates them, and passes them around as needed.

When you read code generated by an AI tool, the variable names tell you what is going on. Good names like userEmail or totalPriceCents make the code feel like English. Bad names like x or temp force the reader to guess.

Example

let userEmail = "matt@delac.io";
userEmail = userEmail.toLowerCase();

Want to use Variable in real work?

WeCode workshops are built around AI coding tools. Pick a tier, or browse more glossary entries to get the lay of the land.