From 5.3 (non character examples skipped)

//

<> != #

Not equal--binary (Relational)

Syntax

<exp1> <> <exp2>

<exp1> != <exp2>

<exp1> # <exp2>

Type

Character, date, logical, memo, NIL, numeric

Operands

<exp1> and <exp2> are expressions of the same data type or NIL

to be compared for inequality.

Description

The not equal ( <>) operator compares two values of the same data type

and returns true (.T.) if <exp1> is not equal to <exp2> according to the

following rules:

. Character: The comparison is based on the underlying ASCII

code and is the inverse of the equal operator (=). This means that

the comparison is sensitive to the current EXACT SETting. See the

examples below.

Examples

. These examples illustrate how the not equal operator (<>)

behaves with different data types:

// Character

SET EXACT ON

? "123" <> "12345" // Result: .T.

? "12345" <> "123" // Result: .T.

? "123" <> "" // Result: .T.

? "" <> "123" // Result: .T.

SET EXACT OFF

? "123" <> "12345" // Result: .T.

? "12345" <> "123" // Result: .F.

? "123" <> "" // Result: .F.

? "" <> "123" // Result: .T.

//

= (equality)

Equal--binary (Relational)

Syntax

<exp1> = <exp2>

Type

Character, date, logical, memo, NIL, numeric

Operands

<exp1> and <exp2> are expressions of the same data type to

compare.

Description

The equal operator (= ) compares two values of the same data type and

returns true (.T.) if <exp1> is equal to <exp2> according to the

following rules:

. Character: The 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).

When EXACT is OFF, two character strings are compared according to

the following rules. assume two character strings, cLeft and cRight,

where the expression to test is (cLeft = cRight):

- If cRight is null, returns true (.T.).

- If LEN(cRight) is greater than LEN(cLeft), returns false

(.F.).

- Compare all characters in cRight with cLeft. If all

characters in cRight equal cLeft, returns true (.T.); otherwise,

returns false (.F.).

With EXACT ON, two strings must match exactly except for trailing

blanks.

Examples

. These examples illustrate how the equal operator (=) behaves

with different data types:

// Character

SET EXACT ON

? "123" = "123 " // Result: .T.

? " 123" = "123" // Result: .F.

SET EXACT OFF

? "123" = "12345" // Result: .F.

? "12345" = "123" // Result: .T.

? "123" = "" // Result: .T.

? "" = "123" // Result: .F.

//

==

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.

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.