Method

Operator_ModuloRight


Description

Used to overload the Mod function, providing custom functionality.

Notes

Create an Operator_ModuloRight function in a class to specify the functionality of the Mod operator for that class. The instance of Self is on the right side of the 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.

Important

This is not currently supported for Android.

Sample code

Using the Vector class (see Operator Add) with two Integer elements, x and y, we define an Operator_ModuloRight function that returns the remainder of the division of the sum of the Self instance by the passed instance.

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

All project types on all supported operating systems.

See also

Mod operator; Operator Modulo function.