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.
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.
Search Encyclopedia
|
Featured Article
|