Operator Modulo

From Xojo Documentation

Revision as of 19:11, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!


Description

Used to overload the Mod function, providing custom functionality.


Notes

Create an Operator_Modulo function in a class to specify the functionality of the Mod operator for that class.

In the function, the Self instance the left operand and the other operand is passed as a parameter.


Examples

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

Function Operator_Modulo (rhs as Vector) as Integer
Dim a, b as Integer
 a=Self.x + Self.y
 b=rhs.x + rhs.y


Return a Mod b


See Also

Mod operator; Operator_ModuloRight function.