Method

# Operator_ModuloRight

<div class="rst-class">

forsearch

</div>

Operator

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

## Description

Used to overload the `Mod</api/language/operators/mathematical/mod>` function, providing custom functionality.

## Notes

Create an <span class="title-ref">Operator_ModuloRight</span> function in a class to specify the functionality of the `Mod</api/language/operators/mathematical/mod>` operator for that class. The instance of `Self</api/language/self_keyword>` is on the right side of the `Mod</api/language/operators/mathematical/mod>` expression. The other instance is passed as a parameter.

The ordinary (left) methods are always preferred; the Right version is used only if there is no legal left version.

<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_ModuloRight</span> function that returns the remainder of the division of the sum of the Self instance by the passed instance.

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

  Return b Mod a
End Function
```

## Compatibility

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

<div class="seealso">

`Mod</api/language/operators/mathematical/mod>` operator; `Operator Modulo</api/language/operators/operator_overloads/operator_modulo>` function.

</div>
