In computer programming, a variable is an identifier (usually a letter, word, or phrase) that is linked to a value stored in the system's memory or an expression that can be evaluated. For instance, a variable might be called "total_count" and contain a number. In imperative programming languages, values can generally be accessed or changed at any time.
However, in pure functional and logic languages, variables are bound to expressions and keep a single value during their entire lifetime due to the requirements of referential transparency. In imperative languages, the same behavior is exhibited by constants, which are typically contrasted with normal variables. Depending on the type system of a programming language, variables may only be able to store a specified datatype (e.g. integer or string).
Alternatively a datatype may be associated only with the current value, allowing a single variable to store anything supported by the programming language. The use of the term "variable" is based on the similar mathematical concept of the same name.