Equals (computing)
From Wikipedia, the free encyclopedia
"=", ASCII character 61.
Common names: ITU-T: equals; gets; takes. Rare: quadrathorpe; INTERCAL: half-mesh.
The equal sign is used in many programming languages, such as BASIC and C as the assignment operator. Other languages, such as Ada and Pascal, use variants such as :=
("becomes equal to") to avoid upsetting mathematicians with statements such as "x = x+1" (and to avoid common typos in comparisons that can happen in languages that consider assignment to be an operator that may be used anywhere in an expression. e.g., the =
– ==
confusion in C). In these languages the :=
is not considered an operator and may only occur between the variable and the expression of the assignment.
It is also used by itself and in compounds such as <=
, >=
, ==
, /=
, !=
for various comparison operators, and in C's +=
, *=
etc. which mimic the primitive operations of two-address code.
Many languages have different equality predicates, operators which test the equality of values. For instance, Perl has the numerical equality operator ==
and the string equality operator eq
.
Equality is a property of values, not objects. An operator which asks if two variables refer to the same data object is an identity predicate, such as Python's is
or Common Lisp's EQ
.