Programming words

What is a variable?

A variable is the name of a piece of data. The name stays, and the value inside can change.

  • city = "Baku" stores Baku under that name.
  • Later city = "Ganja" replaces the old value.
  • You choose the name once, then read it by that name.

A variable is like a box. The name is written on the box, and the value sits inside. Writing to the same name again removes the old value. The name has no space inside it.

Related guides

About this tool

In programming, a variable is the name of a piece of data. The name stays, and the value inside can change. For instance, city = "Baku" stores Baku under that name, and later city = "Ganja" replaces the old value. You choose the name once, then read it by that name. The name has no space inside it.

A variable is like a box where the name is written on the box and the value sits inside. Writing to the same name again removes the old value. People need variables to store, track, and update dynamic information efficiently while running software applications without repeating raw data.

How to use it

  1. Choose a name for your data without any spaces inside.
  2. Assign an initial value to that name using the equals sign.
  3. Read or reference the data later simply by calling its name.
  4. Replace the old value by writing a new value to the same name.

Common uses

Frequently asked questions

What is a variable?

A variable is the name of a piece of data. Its name remains the same, but the value stored inside can change over time.

Can a variable name contain spaces?

No, a variable name cannot contain any spaces inside it. Words must be combined without separation.

What happens to the old value?

Writing a new value to the exact same name completely removes the old value from that container.