6.5.1 The Operators ‘=’ and ‘/=’
The condition expr1 =
expr2 tests whether the
expressions expr1 and expr2 are equal. Depending on the
types of expr1 and expr2, equality is defined as follows:
- expr1 and expr2 are both symbols or both numbers.
- In this case expr1 and expr2 must be identical.
- expr1 and expr2 are strings.
- In this case expr1 and expr2 must be the same, but the
test is case-insensitive.
- expr1 and expr2 are lists.
- In this case expr1 and expr2 must have the same length,
and, for each i, the i-th element of expr1 must
be equal to the i-th element of expr2.
- expr1 and expr2 are records.
- In this case expr1 and expr2 must contain the same
attribute names, though not necessarily in the same order.
For each attribute name, the attribute value of expr1 and the
attribute value of expr2 must be equal.
If expr1 and expr2 do not have the same type and are both
different from the symbol nil
, the test results in an error;
the symbol nil
can be compared to any value without error message.
The test expr1 /=
expr2 holds if and only if the
test expr1 =
expr2 does not hold.