xHarbour Reference Documentation > Operator Reference |
Exact equal operator (binary): compares two values for identity.
<Expression1> == <Expression2>
The "exact equal" operator compares two values of the same data type or NIL. It returns .T. (true) when the left operand has exactly the same value as the right operand, otherwise the return value is .F. (false).
The data types Character and Memo are compared only on the basis of the ASCII values of their characters. The SET EXACT setting is ignored. That means, two operands have exactly the same character values when both have the same length and contain the exact same sequence of characters (case sensitive).
The data types Date, Logic and Numeric are compared to be exactly equal when both operands have the same value.
Variables holding the complex data types Array, Code block, Hash and Object do not store a value but a reference to the value. The "exact equal" operator returns .T. (true) when both operands have the same reference to the complex data type.
See also: | $, <, <=, <> != #, = (comparison), >, >= |
Category: | Comparison operators , Operators |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates resultsof the exact equal operator. PROCEDURE Main ? "ABC" == "ABC" // result: .T. ? "ABC" == "XYZ" // result: .F. ? "ABC" == "ABC " // result: .F. aArray1 := {1, 2, 3} // Create array reference aArray2 := {1, 2, 3} // Create new array reference aArray3 := aArray1 // Assign array reference ? aArray1 == aArray2 // result: .F. ? aArray1 == aArray3 // result: .T. ? aArray2 == aArray3 // result: .F. RETURN
http://www.xHarbour.com