Variable (computer science)

From Wiki @ Karl Jones dot com
Jump to: navigation, search

In computer programming, a variable or scalar is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity or information referred to as a value.

Description

The variable name is the usual way to reference the stored value; this separation of name and content allows the name to be used independently of the exact information it represents.

The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution.

Comparison with variables in mathematics

Variables in programming may not directly correspond to the concept of variables in mathematics. The value of a computing variable is not necessarily part of an equation or formula as in mathematics.

In computing, a variable may be employed in a repetitive process -- assigned a value in one place, then used elsewhere, then reassigned a new value and used again in the same way; see iteration (computing).

Variables in computer programming are frequently given long names to make them relatively descriptive of their use, whereas variables in mathematics often have terse, one- or two-character names for brevity in transcription and manipulation.

See also

External links