Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
In programming, a variable is used to store and represent a value or piece of data. It has a name, a data type, and can hold different values that can be changed during the execution of the program.
Data types specify what kind of values can be stored and manipulated within a program, such as integers, strings, or booleans.
Declaration: Declaration refers to the process of introducing or defining a variable by specifying its name and data type before it is used in the program.
Assignment is the act of giving a value to a variable after it has been declared. It associates the value with the variable's name so that it can be accessed later.