<<Up     Contents

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.

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.

wikipedia.org dumped 2003-03-17 with terodump