== Exactly equal--binary (Relational) ------------------------------------------------------------------------------ Syntax <exp1> == <exp2> Type All Operands <exp1> and <exp2> are expressions of the same data type to be compared. Description The exactly equal operator (==) is a binary operator that compares two values of the same data type for exact equality depending on the data type. It returns true (.T.) if <exp1> is equal to <exp2> according to the following rules: . Array: Compares for identity. If <exp1> and <exp2> are variable references to the same array, returns true (.T.); otherwise, returns false (.F.). . Character: Comparison is based on the underlying ASCII code. ASCII codes for alphabetic characters are ascending (e.g., the code for "A" is 65 and the code for "Z" is 90). Unlike the relational equality operator (=) , true (.T.) is returned if <exp1> and <exp2> are exactly equal including trailing spaces; otherwise, the comparison returns false (.F.). SET EXACT has no effect. . Date: Dates are compared according to the underlying date value; behaves the same as the relational equality operator (=). . Logical: True (.T.) is exactly equal to true (.T.), and false (.F.) is exactly equal to false (.F.). . Memo: Treated the same as character. . NIL: True (.T.) if compared to a NIL value; false (.F.) if compared to a value of any other data type. . Numeric: Compared based on magnitude; behaves the same as the relational equality operator (=). . Object: Treated the same as array. Examples . These examples illustrate how the == operator behaves with different data types: // Character ? "A" == "A" // Result: .T. ? "Z" == "A" // Result: .F. ? "A" == "A " // Result: .F. ? "AA" == "A" // Result: .F. // Array or object aOne := { 1, 2, 3 } aTwo := { 1, 2, 3 } aThree := aOne ? aOne == aTwo // Result: .F. // values within the arrays are equal, but the arrays, // themselves, are separate and distinct ? aOne == aThree // Result: .T.
See Also: $ < <= <> = (equality) > >=