Class

# Variant

<div class="rst-class">

forsearch

</div>

DataType

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

## Description

A <span class="title-ref">Variant</span> is a special data type that can contain any type of data, including arrays. Use the `VarType</api/language/vartype>` function or the <span class="title-ref">Variant</span>'s `Type<variant.type>` method to determine the data type of a <span class="title-ref">Variant</span>.

When performing extensive numeric work, using `Integer</api/data_types/integer>` or `Double</api/data_types/double>` may be preferable both for performance and to avoid conversion behavior which may or may not be desirable.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                         | Type                                                        | Read-Only | Shared |
|----------------------------------------------|-------------------------------------------------------------|-----------|--------|
| `BooleanValue<variant.booleanvalue>`         | `Boolean</api/data_types/boolean>`                          | ✓         |        |
| `CFStringRefValue<variant.cfstringrefvalue>` | `CFStringRef</api/data_types/additional_types/cfstringref>` | ✓         |        |
| `ColorValue<variant.colorvalue>`             | `Color</api/data_types/color>`                              | ✓         |        |
| `CStringValue<variant.cstringvalue>`         | `CString</api/data_types/additional_types/cstring>`         | ✓         |        |
| `CurrencyValue<variant.currencyvalue>`       | `Currency</api/data_types/currency>`                        | ✓         |        |
| `DateTimeValue<variant.datetimevalue>`       | `DateTime</api/data_types/datetime>`                        | ✓         |        |
| `DoubleValue<variant.doublevalue>`           | `Double</api/data_types/double>`                            | ✓         |        |
| `Hash<variant.hash>`                         | `Integer</api/data_types/integer>`                          | ✓         |        |
| `IsArray<variant.isarray>`                   | `Boolean</api/data_types/boolean>`                          | ✓         |        |
| `IsNull<variant.isnull>`                     | `Boolean</api/data_types/boolean>`                          | ✓         |        |
| `IsNumeric<variant.isnumeric>`               | `Boolean</api/data_types/boolean>`                          | ✓         |        |
| `Int32Value<variant.int32value>`             | `Int32</api/data_types/additional_types/int32>`             | ✓         |        |
| `Int64Value<variant.int64value>`             | `Int64</api/data_types/additional_types/int64>`             | ✓         |        |
| `IntegerValue<variant.integervalue>`         | `Integer</api/data_types/integer>`                          | ✓         |        |
| `ObjectValue<variant.objectvalue>`           | `Object</api/data_types/additional_types/object>`           | ✓         |        |
| `OSTypeValue<variant.ostypevalue>`           | `OSType</api/data_types/additional_types/ostype>`           | ✓         |        |
| `PStringValue<variant.pstringvalue>`         | `PString</api/data_types/additional_types/pstring>`         | ✓         |        |
| `PtrValue<variant.ptrvalue>`                 | `Ptr</api/data_types/additional_types/ptr>`                 | ✓         |        |
| `SingleValue<variant.singlevalue>`           | `Single</api/data_types/single>`                            | ✓         |        |
| `StringValue<variant.stringvalue>`           | `String</api/data_types/string>`                            | ✓         |        |
| `UInt32Value<variant.uint32value>`           | `UInt32</api/data_types/additional_types/uint32>`           | ✓         |        |
| `UInt64Value<variant.uint64value>`           | `UInt64</api/data_types/additional_types/uint64>`           | ✓         |        |
| `WStringValue<variant.wstringvalue>`         | `WString</api/data_types/additional_types/wstring>`         | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                               | Parameters   | Returns                            | Shared |
|--------------------------------------------------------------------|--------------|------------------------------------|--------|
| `ArrayElementType<variant.arrayelementtype>`                       |              | `Integer</api/data_types/integer>` |        |
| `Equals<variant.equals>`                                           | v As Variant | `Boolean</api/data_types/boolean>` |        |
| `Operator_Add<variant.operator_add>`                               | v As Variant | Variant                            |        |
| `Operator_AddRight<variant.operator_addright>`                     | v As Variant | Variant                            |        |
| `Operator_And<variant.operator_and>`                               | v As Variant | Variant                            |        |
| `Operator_AndRight<variant.operator_andright>`                     | v As Variant | Variant                            |        |
| `Operator_Compare<variant.operator_compare>`                       | v As Variant | `Integer</api/data_types/integer>` |        |
| `Operator_Divide<variant.operator_divide>`                         | v As Variant | Variant                            |        |
| `Operator_DivideRight<variant.operator_divideright>`               | v As Variant | Variant                            |        |
| `Operator_IntegerDivide<variant.operator_integerdivide>`           | v As Variant | Variant                            |        |
| `Operator_IntegerDivideRight<variant.operator_integerdivideright>` | v As Variant | Variant                            |        |
| `Operator_Modulo<variant.operator_modulo>`                         | v As Variant | Variant                            |        |
| `Operator_ModuloRight<variant.operator_moduloright>`               | v As Variant | Variant                            |        |
| `Operator_Multiply<variant.operator_multiply>`                     | v As Variant | Variant                            |        |
| `Operator_MultiplyRight<variant.operator_multiplyright>`           | v As Variant | Variant                            |        |
| `Operator_Negate<variant.operator_negate>`                         |              | Variant                            |        |
| `Operator_Not<variant.operator_not>`                               |              | Variant                            |        |
| `Operator_Or<variant.operator_or>`                                 | v As Variant | Variant                            |        |
| `Operator_OrRight<variant.operator_orright>`                       | v As Variant | Variant                            |        |
| `Operator_Power<variant.operator_power>`                           | v As Variant | Variant                            |        |
| `Operator_PowerRight<variant.operator_powerright>`                 | v As Variant | Variant                            |        |
| `Operator_Subtract<variant.operator_subtract>`                     | v As Variant | Variant                            |        |
| `Operator_SubtractRight<variant.operator_subtractright>`           | v As Variant | Variant                            |        |
| `Operator_XOr<variant.operator_xor>`                               | v As Variant | Variant                            |        |
| `Operator_XOrRight<variant.operator_xorright>`                     | v As Variant | Variant                            |        |
| `Type<variant.type>`                                               |              | `Integer</api/data_types/integer>` |        |

## Constants

> The following class constants can be used to determine the data type of the **Variant** using the `Type<variant.type>` method. If the <span class="title-ref">variant</span> is an array, use the `ArrayElementType<variant.arrayelementtype>` function to test for the type of array and compare the result to the class constants for scalars.
>
> | Class Constant  | Integer Value | Description                                                                                                           |
> |-----------------|---------------|-----------------------------------------------------------------------------------------------------------------------|
> | TypeArray       | 4096          | Array                                                                                                                 |
> | TypeBoolean     | 11            | `Boolean</api/data_types/boolean>`                                                                                    |
> | TypeCFStringRef | 21            | `CFStringRef</api/data_types/additional_types/cfstringref>`                                                           |
> | TypeColor       | 16            | `Color</api/data_types/color>`                                                                                        |
> | TypeCString     | 18            | `CString</api/data_types/additional_types/cstring>`                                                                   |
> | TypeCurrency    | 6             | `Currency</api/data_types/currency>`                                                                                  |
> | TypeDateTime    | 38            | `DateTime</api/data_types/datetime>`                                                                                  |
> | TypeDelegate    | 39            | `Integer</api/data_types/integer>`                                                                                    |
> | TypeDouble      | 5             | `Double</api/data_types/double>`                                                                                      |
> | TypeInt32       | 2             | `Int32</api/data_types/additional_types/int32>` or `UInt32</api/data_types/additional_types/uint32>`, 32 bit integer. |
> | TypeInt64       | 3             | `Int64</api/data_types/additional_types/int64>` or `UInt64</api/data_types/additional_types/uint64>`. 64 bit integer. |
> | TypeNil         | 0             | `Nil</api/language/nil>`                                                                                              |
> | TypeObject      | 9             | `Object</api/data_types/additional_types/object>`                                                                     |
> | TypeOSType      | 23            | `OSType</api/data_types/additional_types/ostype>`                                                                     |
> | TypePString     | 20            | `PString</api/data_types/additional_types/pstring>`                                                                   |
> | TypePtr         | 26            | `Ptr</api/data_types/additional_types/ptr>`                                                                           |
> | TypeSingle      | 4             | `Single</api/data_types/single>`                                                                                      |
> | TypeString      | 8             | `String</api/data_types/string>`                                                                                      |
> | TypeStructure   | 36            | `Structure</api/language/structure>`                                                                                  |
> | TypeWString     | 19            | `WString</api/data_types/additional_types/wstring>`                                                                   |
>
> If a **Variant** stores an array, the `Type<variant.type>` method will equal Variant.TypeArray logically `OR</api/language/operators/bitwise_logical/or>`'ed with the array element type. You can get the element type by calling `ArrayElementType<variant.arrayelementtype>`.

## Property descriptions

<div id="variant.booleanvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.BooleanValue

**BooleanValue** As `Boolean</api/data_types/boolean>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Boolean</api/data_types/boolean>`.
>
> This property is read-only.

<div id="variant.cfstringrefvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.CFStringRefValue

**CFStringRefValue** As `CFStringRef</api/data_types/additional_types/cfstringref>`

> Returns the value of the <span class="title-ref">Variant</span> as a `CFStringRef</api/data_types/additional_types/cfstringref>`.
>
> This property is read-only.

<div id="variant.colorvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.ColorValue

**ColorValue** As `Color</api/data_types/color>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Color</api/data_types/color>`.
>
> This property is read-only.

<div id="variant.cstringvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.CStringValue

**CStringValue** As `CString</api/data_types/additional_types/cstring>`

> Returns the value of the <span class="title-ref">Variant</span> as a `CString</api/data_types/additional_types/cstring>`.
>
> This property is read-only.

<div id="variant.currencyvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.CurrencyValue

**CurrencyValue** As `Currency</api/data_types/currency>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Currency</api/data_types/currency>`.
>
> This property is read-only.

<div id="variant.datetimevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.DateTimeValue

**DateTimeValue** As `DateTime</api/data_types/datetime>`

> Returns the value of the <span class="title-ref">Variant</span> as a `DateTime</api/data_types/datetime>`.
>
> This property is read-only.

<div id="variant.doublevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.DoubleValue

**DoubleValue** As `Double</api/data_types/double>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Double</api/data_types/double>`.
>
> This property is read-only.

<div id="variant.hash">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Hash

**Hash** As `Integer</api/data_types/integer>`

> Returns a hash value for the <span class="title-ref">Variant</span>, i.e., one that will always be the same for any <span class="title-ref">Variant</span> with the same value.
>
> For objects, it is guaranteed to be unique among all objects currently in existence (though once an object dies, a future object may use the same hash value).
>
> For strings, <span class="title-ref">Hash</span> is case-insensitive.
>
> This property is read-only.

<div id="variant.isarray">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.IsArray

**IsArray** As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Variant</span> is an array.
>
> This property is read-only.

<div id="variant.isnull">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.IsNull

**IsNull** As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Variant</span> is `Nil</api/language/nil>`.
>
> This property is read-only.

<div id="variant.isnumeric">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.IsNumeric

**IsNumeric** As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Variant</span> is a numeric data type or contains a string with a numeric value. For example, if the <span class="title-ref">Variant</span> contains a string describing a number, such as "8", then IsNumeric returns `True</api/language/true>`.
>
> This property is read-only.

<div id="variant.int32value">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Int32Value

**Int32Value** As `Int32</api/data_types/additional_types/int32>`

> Returns the value of the <span class="title-ref">Variant</span> as an `Int32</api/data_types/additional_types/int32>`.
>
> This property is read-only.

<div id="variant.int64value">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Int64Value

**Int64Value** As `Int64</api/data_types/additional_types/int64>`

> Returns the value of the <span class="title-ref">Variant</span> as an `Int64</api/data_types/additional_types/int64>`.
>
> This property is read-only.

<div id="variant.integervalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.IntegerValue

**IntegerValue** As `Integer</api/data_types/integer>`

> Returns the value of the <span class="title-ref">Variant</span> as an `Integer</api/data_types/integer>`.
>
> This property is read-only.

<div id="variant.objectvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.ObjectValue

**ObjectValue** As `Object</api/data_types/additional_types/object>`

> Returns the value of the <span class="title-ref">Variant</span> as an `Object</api/data_types/additional_types/object>`.
>
> This property is read-only.

<div id="variant.ostypevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.OSTypeValue

**OSTypeValue** As `OSType</api/data_types/additional_types/ostype>`

> Returns the value of the <span class="title-ref">Variant</span> as an `OSType</api/data_types/additional_types/ostype>`.
>
> This property is read-only.

<div id="variant.pstringvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.PStringValue

**PStringValue** As `PString</api/data_types/additional_types/pstring>`

> Returns the value of the <span class="title-ref">Variant</span> as a `PString</api/data_types/additional_types/pstring>`.
>
> This property is read-only.

<div id="variant.ptrvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.PtrValue

**PtrValue** As `Ptr</api/data_types/additional_types/ptr>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Ptr</api/data_types/additional_types/ptr>`.
>
> This property is read-only.

<div id="variant.singlevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.SingleValue

**SingleValue** As `Single</api/data_types/single>`

> Returns the value of the <span class="title-ref">Variant</span> as a `Single</api/data_types/single>`.
>
> This property is read-only.

<div id="variant.stringvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.StringValue

**StringValue** As `String</api/data_types/string>`

> Returns the value of the <span class="title-ref">Variant</span> as a `String</api/data_types/string>`.
>
> If the <span class="title-ref">Variant</span> holds a `DateTime</api/data_types/datetime>`, it is converted to a SQLDateTime format. See the `DateTime</api/data_types/datetime>` class for details on this format.
>
> Floating point types include all decimal places available to the extent precision allows. If you want a different format, consider using `DoubleValue<variant.doublevalue>` or `IntegerValue<variant.integervalue>` and then using their ToString methods.
>
> This property is read-only.

<div id="variant.uint32value">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.UInt32Value

**UInt32Value** As `UInt32</api/data_types/additional_types/uint32>`

> Returns the value of the <span class="title-ref">Variant</span> as an `UInt32</api/data_types/additional_types/uint32>`.
>
> This property is read-only.

<div id="variant.uint64value">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.UInt64Value

**UInt64Value** As `UInt64</api/data_types/additional_types/uint64>`

> Returns the value of the <span class="title-ref">Variant</span> as an `UInt64</api/data_types/additional_types/uint64>`.
>
> This property is read-only.

<div id="variant.wstringvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.WStringValue

**WStringValue** As `WString</api/data_types/additional_types/wstring>`

> Returns the value of the <span class="title-ref">Variant</span> as a `WString</api/data_types/additional_types/wstring>`.
>
> This property is read-only.

## Method descriptions

<div id="variant.arrayelementtype">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.ArrayElementType

**ArrayElementType** As `Integer</api/data_types/integer>`

> Returns an integer that indicates the type of the array. The return value can be tested against the <span class="title-ref">Variant</span> class constants or be compared to the integer values given in the `VarType</api/language/vartype>` description.

<div id="variant.equals">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Equals

**Equals**(v As Variant) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Variant</span> has the same value as the <span class="title-ref">Variant</span> passed as a parameter.If the variants are not of the same type a common type is computed & the value is compared for equality.

<div id="variant.operator_add">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Add

**Operator_Add**(v As Variant) As Variant

> Used to define the addition operator for the <span class="title-ref">Variant</span>. See `Operator Add</api/language/operators/operator_overloads/operator_add>`.

<div id="variant.operator_addright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_AddRight

**Operator_AddRight**(v As Variant) As Variant

> Used to define the addition operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator AddRight</api/language/operators/operator_overloads/operator_addright>`.

<div id="variant.operator_and">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_And

**Operator_And**(v As Variant) As Variant

> Used to define the `And</api/language/operators/bitwise_logical/and>` operator for the <span class="title-ref">Variant</span>. See `Operator And</api/language/operators/operator_overloads/operator_and>`.

<div id="variant.operator_andright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_AndRight

**Operator_AndRight**(v As Variant) As Variant

> Used to define the And operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator AndRight</api/language/operators/operator_overloads/operator_andright>`.

<div id="variant.operator_compare">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Compare

**Operator_Compare**(v As Variant) As `Integer</api/data_types/integer>`

> Used to define all the comparison operators for the <span class="title-ref">Variant</span>.

<div id="variant.operator_divide">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Divide

**Operator_Divide**(v As Variant) As Variant

> Used to define the division operator for the <span class="title-ref">Variant</span>. See `Operator Divide</api/language/operators/operator_overloads/operator_divide>`.

<div id="variant.operator_divideright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_DivideRight

**Operator_DivideRight**(v As Variant) As Variant

> Used to define the division operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator DivideRight</api/language/operators/operator_overloads/operator_divideright>`.

<div id="variant.operator_integerdivide">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_IntegerDivide

**Operator_IntegerDivide**(v As Variant) As Variant

> Used to define the integer division operator for the <span class="title-ref">Variant</span>. See `Operator IntegerDivide</api/language/operators/operator_overloads/operator_integerdivide>`.

<div id="variant.operator_integerdivideright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_IntegerDivideRight

**Operator_IntegerDivideRight**(v As Variant) As Variant

> Used to define the integer division operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator IntegerDivideRight</api/language/operators/operator_overloads/operator_integerdivideright>`.

<div id="variant.operator_modulo">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Modulo

**Operator_Modulo**(v As Variant) As Variant

> Used to define the `Mod</api/language/operators/mathematical/mod>` operator for the <span class="title-ref">Variant</span>. See `Operator Modulo</api/language/operators/operator_overloads/operator_modulo>`.

<div id="variant.operator_moduloright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_ModuloRight

**Operator_ModuloRight**(v As Variant) As Variant

> Used to define the `Mod</api/language/operators/mathematical/mod>` operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right.

<div id="variant.operator_multiply">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Multiply

**Operator_Multiply**(v As Variant) As Variant

> Used to define the multiplication operator for the <span class="title-ref">Variant</span>. See `Operator Multiply</api/language/operators/operator_overloads/operator_multiply>`.

<div id="variant.operator_multiplyright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_MultiplyRight

**Operator_MultiplyRight**(v As Variant) As Variant

> Used to define the multiplication operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. `Operator Multiply Right</api/language/operators/operator_overloads/operator_multiplyright>`.

<div id="variant.operator_negate">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Negate

**Operator_Negate** As Variant

> Use to define the negation operator for the <span class="title-ref">Variant</span>. See `Operator Negate</api/language/operators/operator_overloads/operator_negate>`.

<div id="variant.operator_not">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Not

**Operator_Not** As Variant

> Used to define the `Not</api/language/operators/bitwise_logical/not>` operator for the <span class="title-ref">Variant</span>. See `Operator Not</api/language/operators/operator_overloads/operator_not>`.

<div id="variant.operator_or">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Or

**Operator_Or**(v As Variant) As Variant

> Used to define the `Or</api/language/operators/bitwise_logical/or>` operator for the <span class="title-ref">Variant</span>. See `Operator Or</api/language/operators/operator_overloads/operator_or>`.

<div id="variant.operator_orright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_OrRight

**Operator_OrRight**(v As Variant) As Variant

> Used to define the `Or</api/language/operators/bitwise_logical/or>` operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator OrRight</api/language/operators/operator_overloads/operator_orright>`.

<div id="variant.operator_power">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Power

**Operator_Power**(v As Variant) As Variant

> Used to define the power (`^</api/language/operators/mathematical/^>`) operator for the <span class="title-ref">Variant</span>. See `Operator Power</api/language/operators/operator_overloads/operator_power>`.

<div id="variant.operator_powerright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_PowerRight

**Operator_PowerRight**(v As Variant) As Variant

> Used to define the power (`^</api/language/operators/mathematical/^>`) operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator PowerRight</api/language/operators/operator_overloads/operator_powerright>`.

<div id="variant.operator_subtract">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_Subtract

**Operator_Subtract**(v As Variant) As Variant

> Used to define the subtraction operator for the <span class="title-ref">Variant</span>. See `Operator Subtract</api/language/operators/operator_overloads/operator_subtract>`.

<div id="variant.operator_subtractright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_SubtractRight

**Operator_SubtractRight**(v As Variant) As Variant

> Used to define the subtraction operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See `Operator SubtractRight</api/language/operators/operator_overloads/operator_subtractright>`.

<div id="variant.operator_xor">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_XOr

**Operator_XOr**(v As Variant) As Variant

> Used to define the `XOr</api/language/operators/bitwise_logical/xor>` operator for the <span class="title-ref">Variant</span>. See the definitions of the `XOr</api/language/operators/bitwise_logical/xor>` operator in the `XOr</api/language/operators/bitwise_logical/xor>` description. See `Operator XOr</api/language/operators/operator_overloads/operator_xor>`

<div id="variant.operator_xorright">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Operator_XOrRight

**Operator_XOrRight**(v As Variant) As Variant

> Used to define the `XOr</api/language/operators/bitwise_logical/xor>` operator for the <span class="title-ref">Variant</span> with the implicit `Self</api/language/self_keyword>` on the right. See the definitions of the `XOr</api/language/operators/bitwise_logical/xor>` operator in the `XOr</api/language/operators/bitwise_logical/xor>` description. See `Operator XOrRight</api/language/operators/operator_overloads/operator_xorright>`.

<div id="variant.type">

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

</div>

<div class="rst-class">

forsearch

</div>

Variant.Type

**Type** As `Integer</api/data_types/integer>`

> Returns an `Integer</api/data_types/integer>`, indicating the data type of the <span class="title-ref">Variant</span>. The values of each data type are given in the table in the Notes section of the `VarType</api/language/vartype>` function.
>
> If the <span class="title-ref">Variant</span> is an array, then Type returns TypeArray logically OR'ed with the array element type. You can get the element type by calling ArrayElementType.
>
> An array of Dates will be designated as an array of Objects.
>
> If the <span class="title-ref">Variant</span> is not `Nil</api/language/nil>`, it provides the same functionality as the `VarType</api/language/vartype>` global function. You can use the <span class="title-ref">Variant</span> class constants instead of the integer values to determine the data type. The names are listed as *Class Constants* on the <span class="title-ref">Variant</span> page.

## Notes

### Particularities of the <span class="title-ref">variant</span> object

The default value of a <span class="title-ref">Variant</span> is `Nil</api/language/nil>`. However, unlike other objects, you can use the above methods with a `Nil</api/language/nil>` <span class="title-ref">Variant</span> without raising a `NilObjectException</api/exceptions/nilobjectexception>`.

For example, the following is valid for a <span class="title-ref">Variant</span> but not for any other `Object</api/data_types/additional_types/object>`:

``` xojo
Var v As Variant = Nil
Var vType As Integer ' To store the variant type

vType = v.Type ' It does not raise NilObjectException
```

This peculiarity allows you to use the method `IsNull<variant.isnull>` instead of *v = Nil*. They both give the same result:

``` xojo
Var v As Variant

If v = Nil Then
...
End If

' OR you can write

If v.IsNull Then
...
End If
```

Variants do not have a specific default value, but will instead get the default value of whatever type they are converted to (see the next section).

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

### Automatic conversion of values

When you assign a <span class="title-ref">Variant</span> to a `string</api/data_types/string>`, numeric, or `DateTime</api/data_types/datetime>` variable, value of the <span class="title-ref">Variant</span> is converted to the variable's data type. For example,

``` xojo
Var v As Variant
Var n As Integer
Var s As String
v = 25
s = v ' s is "25"
v = "25"
n = v ' n is 25
```

If there is any ambiguity concerning the type conversion of a <span class="title-ref">Variant</span>, you should use one of the properties of the <span class="title-ref">Variant</span> class to force the compiler to convert the <span class="title-ref">Variant</span> to the desired type. In this example, the Product number is supposed to be the string concatenation of the Model number and the Part Number. To do this, use the `StringValue<variant.stringvalue>` property to specifically tell the compiler to do what you want:

``` xojo
Var model, partNumber, product As Variant
model = 100
partNumber = 546
product = model + partNumber ' product=646
product = model.StringValue + partNumber.StringValue ' product="100546"
```

Or, you could just type the variables as `String</api/data_types/string>` and do string concatenation directly.

Variants used in an expression convert themselves to the type of the other operand, no matter what kind of data they contain, instead of deferring the type-conversion until runtime. This only affects expressions involving a <span class="title-ref">Variant</span> operand and an operand of some other type, not expressions in which both operands are variants.

Consider the following example:

``` xojo
Var v As Variant = 0.5
```

The comparison:

``` xojo
If v > 0 Then
```

returns `False</api/language/false>` since v is being treated as an `Integer</api/data_types/integer>` and will round down to 0.

If you instead use:

``` xojo
If v > 0.0 Then
```

the comparison returns `True</api/language/true>`.

The comparison:

``` xojo
If v.DoubleValue > 0 Then
```

also returns `True</api/language/true>`.

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

### Conversion from nil

If you assign a Nil <span class="title-ref">Variant</span> to an intrinsic type, then the value will be the default value for the intrinsic type:

``` xojo
Var v As Variant = Nil
Var b As Boolean = v ' False
Var d As Double = v ' 0.0
Var i As Integer = v  ' 0
Var s As String = v ' ""
```

## Compatibility

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

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `IsNumeric</api/language/isnumeric>`, `VarType</api/language/vartype>` functions; `Dictionary</api/language/dictionary>` classes;

</div>
