Equals Sign - Usage in Mathematics and Computer Programming

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

Other articles related to "usage in mathematics and computer programming":

Equals Sign - Usage in Mathematics and Computer Programming - Usage of Several Equal-signs
... JavaScript has the same semantics for ===, referred to as "equality without type coercion" ... However in JavaScript the behavior of == cannot be described by any simple consistent rules ...

Famous quotes containing the words programming, computer and/or usage:

    If there is a price to pay for the privilege of spending the early years of child rearing in the driver’s 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)

    The computer takes up where psychoanalysis left off. It takes the ideas of a decentered self and makes it more concrete by modeling mind as a multiprocessing machine.
    Sherry Turkle (b. 1948)

    Pythagoras, Locke, Socrates—but pages
    Might be filled up, as vainly as before,
    With the sad usage of all sorts of sages,
    Who in his life-time, each was deemed a bore!
    The loftiest minds outrun their tardy ages.
    George Gordon Noel Byron (1788–1824)