Operator

# \\ (Integer Division)

<div class="rst-class">

forsearch

</div>

.. rst-class:: forsearch

Operator

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

## Description

The \\ operator is used to perform `Integer</api/data_types/integer>` division between two numbers.

## Usage

``` xojo
result = expression1 \ expression2
```

| Part        | Type                               | Description                                                                         |
|-------------|------------------------------------|-------------------------------------------------------------------------------------|
| result      | `Integer</api/data_types/integer>` | The `Integer</api/data_types/integer>` division of *expression1* and *expression2*. |
| expression1 | Number                             | Any numeric expression.                                                             |
| expression2 | Number                             | Any numeric expression.                                                             |

## Notes

Use this operator when you require division that does not consider the decimal portion of the expressions. The result may differ from systems that round the expressions prior to the division.

If expression1 and expression2 are not `integers</api/data_types/integer>`, they are coerced to `` Int32</api/data_types/additional_types/int32>`s. The result is an :doc:`Integer</api/data_types/integer> ``. If you divide by zero, the result is undefined even if the numerator is also zero. The only expected behavior is the application will not crash. For that reason, you should always check to see whether the denominator is zero before using \\

When converting a floating point number to an `Integer</api/data_types/integer>`, there is always the chance of data loss. The same is true when a floating-point value holds a sentinel such as infinity or NaN. `integers</api/data_types/integer>` do not reserve space for sentinel values, so that information is lost. Converting a floating-point number that represents a sentinel to an `Integer</api/data_types/integer>` yields undefined results.

Use the `/</api/language/operators/mathematical/division>` operator for floating point division and the `Mod</api/language/operators/mathematical/mod>` operator to obtain the remainder of the division.

You can use `Operator IntegerDivide</api/language/operators/operator_overloads/operator_integerdivide>` to define the \\ operator for classes.

## Sample code

This code stores the result of a division of two numbers in a variable:

``` xojo
Var x As Integer
x = 50.56 \ 30.34 ' x is 1 
x = 49.56 \ 25.34 ' x is 1 
```

## Compatibility

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

<div class="seealso">

`/</api/language/operators/mathematical/division>`, `Mod</api/language/operators/mathematical/mod>` operators; `Operator IntegerDivide</api/language/operators/operator_overloads/operator_integerdivide>` function; `Operator precedence</api/language/operators/operator_precedence>`

</div>
