Skip to content
>devspeak
← glossary
level 0Foundations

Variable

also: variables

A named spot in the code that holds a value, like a number or a piece of text. The value can change while the app runs.

a bit more technical

A name bound to a value in a program. Code reads and updates variables to keep track of information, such as a user's name, a running total, or whether a menu is open.

picture it

A labeled jar in the kitchen. The label says "sugar" and stays the same, but how much sugar is inside changes as you cook.

why it matters

Agents often explain bugs in terms of variables: a value was empty, wrong, or not updated in time. Knowing a variable is just a labeled value helps you follow those explanations.

what your agent might say
agent
The total showed $0 because the cartTotal variable was reset every time the page reloaded. I'll keep its value between visits.
how you might use it
you → your agent
The greeting says 'Hello, undefined'. Check which variable holds the user's name and find out why it's empty.
common mistake

Thinking a variable is a fixed setting. The name stays the same, but the value inside it can change while the app is running.

builds on