Operator

# =

<div class="rst-class">

forsearch

</div>

=

<div class="rst-class">

forsearch

</div>

Operator

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

## Description

The = character is to determine whether one expression is equal to another or to assign a value to a property or variable. `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 equal to *expression2*. |
| expression1 | `String</api/data_types/string>`, Number, `Boolean</api/data_types/boolean>`, `Color</api/data_types/color>`, or `Object</api/data_types/additional_types/object>` | Any expression.                                                                |
| expression2 | `String</api/data_types/string>`, Number, `Boolean</api/data_types/boolean>`, `Color</api/data_types/color>` or `Object</api/data_types/additional_types/object>`  | Any expression.                                                                |

**or**

``` xojo
result = value
```

| Part   | Type | Description                                                               |
|--------|------|---------------------------------------------------------------------------|
| result | Any  | The property, variable, array, or array element that is assigned *value*. |
| value  | Any  | The value assigned to result.                                             |

## 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.

Use `String<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

The following example tests whether two strings are equal.

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

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

## Compatibility

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

<div class="seealso">

`Equals</api/language/equals>`, `\></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/not_equal>` operators; `Operator Compare</api/language/operators/operator_overloads/operator_compare>`, `String<string.compare>` functions; `Operator precedence</api/language/operators/operator_precedence>`.

</div>
