# Variable

In mathematics, a variable is a symbol or letter, such as "x" or "y," that represents a value. In algebraic equations, the value of one variable is often dependent on the value of another. For example, in the equation below, y is the "dependent variable" because its value is based on the value assigned to the "independent variable" x.

y = 10 + 2x

The equation above may also be called a function since y is a function of x. If x = 1, then y = 12. If x = 2, then y = 14.

Variables are also used in computer programming to store specific values within a program. They are assigned both a data type as well as a value. For example, a variable of the string data type may contain a value of "sample text" while a variable of the integer data type may contain a value of "11". Some programming languages require variables to be declared before they can be used, while others allow variables to be created on the fly. The data type, if not defined explicitly, is determined based on the initial value given to the variable.

A function within a program may contain multiple variables, each of which may be assigned different values based on the input parameters. Likewise, a variable may also be used to return a specific value as the output of a function. In the Java example below, the variable i is incremented during each iteration of the while loop, and x is returned as the output.

while (i < max)
{
x = x+10;
i++;
}

return x;

As the name implies, the value of a variable can change. Variables that store values that do not change are called constants.

Updated: May 3, 2012

Cite this definition:

https://techterms.com/definition/variable

#### TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definition of Variable. It explains in computing terminology what Variable means and is one of many technical terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Variable definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!