Variable

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A variable is a special type of amount or quantity with an unknown value. They are often used in programming computers or in mathematical equations.

A number such as 5 or 200 cannot change its value. For example, if a person stands 5 feet away from a building, the distance variable compared to the building does not change over time. 5 feet is called a fixed amount, which is the opposite of a variable amount.

But if a person walks away from the building, the distance variable compared to the building is increasing. So it does not have the same value and we can not use the same number for it, as the distance might be 1 foot now, but 2 feet a second later. In mathematics, a variable is usually given a letter, such as x or y.

In some equations, variables are used to show numbers that are unknown. Using a type of math called algebra, one can find the value of the variable.

In computer science, a variable does not have to be a number—it may be a string (text) value, or a date, or an amount of money, or even an object such as a picture.