Value1 <> Value2 Value1 <> Value2

Value1

The first value to compare.

Value2

The second value to compare.

Returns

Logical Logical

Whether the first value is not equal to the second value.

Returns whether the first value is not equal to the second value. 2 <> 32 <> 3 returns TRUE, but 2 <> 22 <> 2 and "a" <> "A""a" <> "A" return FALSE. Text string comparisons are case-insensitive.

This operator also works with arrays. { 5, 7 } <> 7{ 5; 7 } <> 7 returns the array { TRUE, FALSE }{ TRUE; FALSE } (equivalent to { 5 <> 7, 7 <> 7 }{ 5 <> 7; 7 <> 7 }) and { 5, 7 } <> { 5, 10 }{ 5; 7 } <> { 5; 10 } returns the array { FALSE, TRUE }{ FALSE; TRUE } (equivalent to { 5 <> 5, 7 <> 10 }{ 5 <> 5; 7 <> 10 }).

Related operators and functions

The != operator is similar to this operator, but is case-sensitive and returns a single logical value when applied to arrays (see below for an example).

The EXACT function may be used to compare to text strings in a case-sensitive manner, like the != operator.

The first formula below returns FALSE and the remaining three formulas return TRUE:

"Test" <> "test"
"Test" <> "test"

"Test" != "test"
"Test" != "test"

NOT ( EXACT ("Test", "test"))
NOT ( EXACT ("Test"; "test"))

! EXACT ("Test", "test")
! EXACT ("Test"; "test")

FILTER, arrays and <>

The logical arrays returned by this operator are especially useful with functions like FILTER, which takes an array and returns another array only containing certain elements.

This formula returns the array { 4 }{ 4 }:

FILTER ({ 2, 4 }, { 2, 4 } <> 2)
FILTER ({ 2; 4 }; { 2; 4 } <> 2)

2 is left out, because it is equal to itself.

The formula above works because { 2, 4 } <> 2{ 2; 4 } <> 2 is expanded to the array { FALSE, TRUE }{ FALSE; TRUE } by the <> operator. As such, the formula above is equivalent to this formula:

FILTER ({ 2, 4 }, { FALSE, TRUE })
FILTER ({ 2; 4 }; { FALSE; TRUE })

Determining if two arrays differ from one another

To determine if two arrays differ from one another, <> can be used together with the OR function. This formula returns TRUE:

OR ({ 2, 3 } <> { 2, 2 })
OR ({ 2; 3 } <> { 2; 2 })

The formula above works because { 2, 3 } <> { 2, 2 }{ 2; 3 } <> { 2; 2 } is expanded to the array { FALSE, TRUE }{ FALSE; TRUE } by the <> operator. As such, the formula above is equivalent to this formula:

OR ({ FALSE, TRUE })
OR ({ FALSE; TRUE })

If the arrays are of different sizes, <> returns errors for the missing elements, and so does OR. To handle arrays of any size, compare their sizes first. This formula returns TRUE if the arrays Array1 and Array2 differ from one another:

IF ( SIZE (Array1) = SIZE (Array2), OR (Array1 <> Array2), TRUE)
IF ( SIZE (Array1) = SIZE (Array2); OR (Array1 <> Array2); TRUE)

The != operator can also be used to determine if two arrays differ from one another, and handles arrays of different sizes. Unlike <> , it compares text strings in a case-sensitive manner. This formula returns TRUE:

{ 2, 3 } != { 2, 2 }
{ 2; 3 } != { 2; 2 }

Records and tables

Two records are not equal if any of their members of the same name are not equal. The order of the members does not matter. Text strings in the members are compared in a case-insensitive manner.

RECORD (A: 1) <> RECORD (A: 2) RECORD (A: 1) <> RECORD (A: 2) returns TRUE, but RECORD (A: 1, B: 2) <> RECORD (B: 2, A: 1) RECORD (A: 1; B: 2) <> RECORD (B: 2; A: 1) returns FALSE.

Tables are compared row by row, like arrays. TABLE (A: { 1, 2 }) <> TABLE (A: { 1, 3 }) TABLE (A: { 1; 2 }) <> TABLE (A: { 1; 3 }) returns the array { FALSE, TRUE }{ FALSE; TRUE }.

Examples

2 <> 3
2 <> 3

Returns TRUE.

2 <> 2
2 <> 2

Returns FALSE.

"a" <> "A"
"a" <> "A"

Returns FALSE. Text string comparisons are case-insensitive.

NOT ( EXACT ("a", "A"))
NOT ( EXACT ("a"; "A"))

Returns TRUE, as EXACT compares text strings in a case-sensitive manner.

"a" != "A"
"a" != "A"

Returns TRUE, as the != operator compares text strings in a case-sensitive manner.

{ 5, 7 } <> 7
{ 5; 7 } <> 7

Returns the array { TRUE, FALSE }{ TRUE; FALSE }, equivalent to { 5 <> 7, 7 <> 7 }{ 5 <> 7; 7 <> 7 }.

{ 5, 7 } <> { 5, 10 }
{ 5; 7 } <> { 5; 10 }

Returns the array { FALSE, TRUE }{ FALSE; TRUE }, equivalent to { 5 <> 5, 7 <> 10 }{ 5 <> 5; 7 <> 10 }.

FILTER ({ 2, 4 }, { 2, 4 } <> 2)
FILTER ({ 2; 4 }; { 2; 4 } <> 2)

Returns the array { 4 }{ 4 }. 2 is left out, because it is equal to itself.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell