Method

# Operator_IntegerDivide

<div class="rst-class">

forsearch

</div>

Operator

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

## Description

Used to overload the `Integer Division</api/language/operators/mathematical/integer_division>` operator, providing custom functionality.

## Notes

Create an <span class="title-ref">Operator_IntegerDivide</span> function in a class to specify the functionality of the `Integer Division</api/language/operators/mathematical/integer_division>` operator for that class.

In the function, the `Self</api/language/self_keyword>` instance is the left operand and the other operand is passed as a parameter. Whenever you use the `Integer Division</api/language/operators/mathematical/integer_division>` operator in your code to operate on two instances of the class and the `Self</api/language/self_keyword>` instance is on the left, your <span class="title-ref">Operator_IntegerDivide</span> function will be called.

<div class="important">

<div class="title">

Important

</div>

This is not currently supported for Android.

</div>

## Sample code

Using the Vector class (see `Operator Add</api/language/operators/operator_overloads/operator_add>`) with two `Integer</api/data_types/integer>` elements, x and y, we define an <span class="title-ref">Operator_IntegerDivide</span> function that divides the sum of the `Self</api/language/self_keyword>` instance with the passed instance.

``` xojo
Function Operator_IntegerDivide(rhs As Vector) As Integer
  Var a, b As Integer
  a = Self.x + Self.y
  b = rhs.x + rhs.y

  Return a \ b
End Function
```

## Compatibility

|                       |                               |
|-----------------------|-------------------------------|
| **Project Types**     | Console, Desktop, Mobile, Web |
| **Operating Systems** | iOS, Linux, macOS, Windows    |

<div class="seealso">

`Operator IntegerDivideRight</api/language/operators/operator_overloads/operator_integerdivideright>`, `Integer Division</api/language/operators/mathematical/integer_division>` functions.

</div>
