DataType

# UInteger

<div class="rst-class">

forsearch

</div>

DataType

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

## Description

Used to store positive integer values. The default value is 0. Generally you will use the Integer data type (equivalent to `Int32</api/data_types/additional_types/int32>` on 32-bit apps or `Int64</api/data_types/additional_types/int64>` on 64-bit apps) or <span class="title-ref">UInteger</span> (equivalent to `UInt32</api/data_types/additional_types/uint32>` on 32-bit apps or `UInt64</api/data_types/additional_types/uint64>` on 64-bit apps). There are also other size-specific integer data types that are available for use with external OS APIs.

## Notes

<span class="title-ref">UInteger</span> values use 4 bytes for 32-bit apps and 8 bytes for 64-bit apps.

<span class="title-ref">UInteger</span> values range from 0 to 4,294,967,295 (32-bit apps) or 0 to 2^64-1 (18,446,744,073,709,551,615) (64-bit apps).

If you assign a value that is larger (or smaller) than what the specific Integer type can hold, then the value will "overflow". This means the value will wrap around to the corresponding largest or smallest value and continue from there.

All integers on Android are 64-bit integers.

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

### Comparing a <span class="title-ref">UInteger</span> to a literal or constant

The type of a numeric literal or constant that is a whole number is the same `integer</api/data_types/integer>` type as the architecture of the platform for which you are building. That means that if you are building for 64 bit, literals and constants will be 64 bit (signed) `integers</api/data_types/integer>`.

Therefore to correctly compare them, use `CType</api/language/ctype>` to cast the literal to a <span class="title-ref">UInteger</span>.

In this example the variable Distance is a \`UInteger\`:

``` xojo
If Distance = CType(0, UInteger) Then
  MessageBox("You have arrived.")
End If
```

## Sample code

``` xojo
Var value As UInteger
value = 42
value = value * 2
```

## Compatibility

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

<div class="seealso">

`Var</api/language/var>` command; `Integer</api/data_types/integer>`, `Byte</api/data_types/additional_types/byte>`, `UInt8</api/data_types/additional_types/uint8>`, `UInt16</api/data_types/additional_types/uint16>`, `UInt32</api/data_types/additional_types/uint32>` and `UInt64</api/data_types/additional_types/uint64>` data types.

</div>
