Usage in Mathematics and Computer Programming
In mathematics, the equals sign may express a simple statement of fact (x = 2), a definition (let x = 2), or a condition (if x = 2 then...).
The first important computer programming language to use the equals sign was the original version of Fortran, FORTRAN I, designed in 1954 and implemented in 1957. In Fortran, "=" serves as an assignment operator: X = 2
sets the value of X
to 2. This somewhat resembles the use of "=" in a mathematical definition, but with different semantics: the expression following "=" is evaluated first and may refer to a previous value of X
. For example, the assignment X = X + 2
increases the value of X
by 2.
A rival programming-language usage was pioneered by the original version of ALGOL, which was designed in 1958 and implemented in 1960. ALGOL included a relational operator that tested for equality, allowing constructions like if x = 2
with essentially the same meaning of "=" as the conditional usage in mathematics. The equals sign was reserved for this usage.
Both usages have remained common in different programming languages into the early 21st century. As well as Fortran, "=" is used for assignment in such languages as C, Perl, Python, awk, and their descendants. But "=" is used for equality and not assignment in the Pascal family, Ada, Eiffel, APL, and other languages.
A few languages, such as BASIC and PL/I, have used the equals sign to mean both mean assignment and equality, distinguished by context. However, in most languages where "=" has one of these meanings, a different character or, more often, a sequence of characters is used for the other meaning. Following ALGOL, most languages that use "=" for equality use ":=" for assignment, although APL, with its special character set, uses a left-pointing arrow.
Fortran did not have an equality operator (it was only possible to compare an expression to zero, using the arithmetic IF statement) until FORTRAN IV was released in 1962, since when it has used the four characters ".EQ." to test for equality. The language B introduced the use of "==" with this meaning, which has been copied by its descendant C and most later languages where "=" means assignment.
Read more about this topic: Equals Sign
Famous quotes containing the words usage, mathematics, computer and/or programming:
“Girls who put out are tramps. Girls who dont are ladies. This is, however, a rather archaic usage of the word. Should one of you boys happen upon a girl who doesnt put out, do not jump to the conclusion that you have found a lady. What you have probably found is a lesbian.”
—Fran Lebowitz (b. 1951)
“It is a monstrous thing to force a child to learn Latin or Greek or mathematics on the ground that they are an indispensable gymnastic for the mental powers. It would be monstrous even if it were true.”
—George Bernard Shaw (18561950)
“What, then, is the basic difference between todays computer and an intelligent being? It is that the computer can be made to see but not to perceive. What matters here is not that the computer is without consciousness but that thus far it is incapable of the spontaneous grasp of patterna capacity essential to perception and intelligence.”
—Rudolf Arnheim (b. 1904)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)