Language / Technology

Why do programs use variables?

The short answer

Variables give names to stored values so a program can reuse and update data.

How it works

A search term or total can be stored in a variable and reused for display, calculation, and conditions. Clear names make code easier to understand.

A familiar example

It can help to think of a variable as a name or reference for a value, not only as a physical box.

Sources