xHarbour Reference Documentation > Operator Reference xHarbour Developers Network  

==

Exact equal operator (binary): compares two values for identity.

Syntax

<Expression1> == <Expression2>

Arguments

<Expression>
The values of <Expression1> and <Expression2> must have the same data type or can be NIL, and are compared.

Description

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.

Info

See also:$, <, <=, <> != #, = (comparison), >, >=
Category: Comparison operators , Operators
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe