Method

# Round

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

## Description

Returns the passed value rounded to the nearest whole number.

## Usage

``` xojo
result = Round(value)
```

| Part   | Type                             | Description                                                                                                                 |
|--------|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| result | `Double</api/data_types/double>` | The rounded *value*. Although result is typed as a `Double</api/data_types/double>`, it actually contains an integer value. |
| value  | `Double</api/data_types/double>` | The value you want to <span class="title-ref">round</span>.                                                                 |

## Notes

The result of this function is a `Double</api/data_types/double>`, but it will always contain a whole number.

The method used to <span class="title-ref">Round</span> is chosen by the operating system and the results may vary from platform to platform when the number to be rounded is exactly halfway between two whole numbers.

## Sample code

This example uses the <span class="title-ref">Round</span> function to return a rounded number

``` xojo
Var d As Double
d = Round(1.499) ' returns 1
d = Round(1.500) ' returns 2
```

## Compatibility

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

<div class="seealso">

`Ceiling</api/math/ceiling>`, `Floor</api/math/floor>` functions.

</div>
