Encyclopedia > Variable

  Article Content

Variable

A variable is something that is subject to change. In computer science and mathematics, it denotes a name that is used to represent an unknown value or quantity. Variables are used in open sentences. For instance, in the formula: x + 1 = 5, x is a variable which represents an "unknown" number. In mathematics, variables are usually represented by letters of the Roman alphabet, but are also represented by letters of other alphabets; as well as various other symbols. In computer programming, variables are usually represented by either single letters or alphanumeric strings[?].

Variables are useful in mathematics and computer programming because they allow instructions to be specified in a general way. If one were forced to use actual values, then the instructions would only apply in a more narrow, and specific, set of situations. For instance, by using variables, we can Now, all we need to do to find the square of a number is replace x with any number we want. For example: specify a mathematical definition for finding the square of ANY number: square(x) = x * x.

  • square(x) = x * x = y
  • square(1) = 1 * 1 = 1
  • square(2) = 2 * 2 = 4
  • square(3) = 3 * 3 = 9
etc...

In the above example, the variable x is a "placeholder[?]" for ANY number. One important thing we are assuming is that the value of each occurrence of x is the same -- that x does not get a new value between the first x and the second x. In computer programming, such changes can occur.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Oslo accords

... known as Oslo. The Interim Agreement on the West Bank and the Gaza Strip (also called Oslo 2), signed in September 1995 which gave the Palestinians self-rule in ...