Operator

# Not equal

<div class="rst-class">

forsearch

</div>

Operator

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to determine whether one expression is <span class="title-ref">Not equal</span> to another. `String</api/data_types/string>` comparisons are case-insensitive.

## Usage

``` xojo
result = expression1 <> expression2
```

| Part        | Type                                                                                                                                                                 | Description                                                                        |
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| result      | `Boolean</api/data_types/boolean>`                                                                                                                                   | Returns `True</api/language/true>` if *expression1* is not equal to *expression2*. |
| expression1 | `String</api/data_types/string>`, Number, `Object</api/data_types/additional_types/object>`, `Color</api/data_types/color>`, or `DateTime</api/data_types/datetime>` | Any expression.                                                                    |
| expression2 | `String</api/data_types/string>`, Number, `Object</api/data_types/additional_types/object>`, `Color</api/data_types/color>`, or `DateTime</api/data_types/datetime>` | Any expression.                                                                    |

## Notes

The data types of expression1 and expression2 must match. You can make comparisons between objects of any data type and between objects. If you compare objects, \<\> compares their references, not their contents. For example, when you compare two `FolderItems</api/files/folderitem>`, \<\> determines whether they have the same reference, not whether they point to the same file.

The \<\> operator is also used with objects to test whether they are `Nil</api/language/nil>`. For example, when you use the `MemoryBlock</api/language/memoryblock>` constructor to create a new object, test whether the new object is `Nil</api/language/nil>` before proceeding.

Use `String.Compare<string.compare>` to do a case-sensitive `string</api/data_types/string>` comparison.

You can use `Operator Compare</api/language/operators/operator_overloads/operator_compare>` to define comparisons for classes.

## Sample code

Check if two string values are different:

``` xojo
Var t1 As String = "Hello"
Var t2 As String = "There"

If t1 <> t2 Then
  ' t1 is not equal to t2
Else
  ' t1 is equal to t2
End If
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Test that an object is not Nil before it is used:

``` xojo
Var d As New Dictionary
If d <> Nil Then
  d.Value("Test") = "Hello"
End If
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`\></api/language/operators/comparison/greater_than>`, `\>=</api/language/operators/comparison/greater_than_or_equal>`, `<</api/language/operators/comparison/less_than>`, `\<=</api/language/operators/comparison/less_than_or_equal>`, `=</api/language/operators/comparison/equals_operator>`<span class="title-ref"> operators; :doc:\`Operator Compare\</api/language/operators/operator_overloads/operator_compare\></span>, `String.Compare<string.compare>` functions; `Operator precedence</api/language/operators/operator_precedence>`.

</div>
