Method

# Sign

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

## Description

Returns the <span class="title-ref">Sign</span> of the number passed to it.

## Usage

``` xojo
result = Sign(value)
```

| Part   | Type                               | Description                                                                                                                                |
|--------|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| result | `Integer</api/data_types/integer>` | The <span class="title-ref">sign</span> of *value*. Returns -1 if *value* is negative, 0 if *value* is zero, and 1 if *value* is positive. |
| value  | `Double</api/data_types/double>`   | The number being passed to the function.                                                                                                   |

## Sample code

The following example determines the <span class="title-ref">Sign</span> of the number passed to it.

``` xojo
Var result As Integer
If Not TextField1.Text.IsEmpty Then
  result = Sign(TextField1.Text.ToDouble)
  MessageBox(result.ToString)
Else
  MessageBox("Please enter a number!")
End If
```

## Compatibility

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

<div class="seealso">

`Abs</api/math/abs>` function.

</div>
