Literal

# &h

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

## Description

Used to represent a hexadecimal literal.

## Usage

``` xojo
&hHexNumber
```

| Part      | Type               | Description                  |
|-----------|--------------------|------------------------------|
| HexNumber | Hexadecimal number | A hexadecimal literal value. |

## Notes

To write a hexadecimal literal, precede the value with <span class="title-ref">&h</span>.

## Sample code

Assign a number using a hex literal:

``` xojo
Var hex As Integer
hex = &hff ' hex = 255 as a decimal integer
```

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

To get the numerical value (myValue) of a hexadecimal string (s):

``` xojo
Var myValue As Integer
myValue = Val("&h" + s)
' If s is "A4", myValue will contain the value 164 which corresponds to &hA4
```

## Compatibility

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

<div class="seealso">

`Hex</api/text/hex>` function.

</div>
