Note: information on this page refers to Ceylon 1.1, not to the current release.

%= (remainder assign) operator

The right-associative, binary infix %= operator takes the remainder of it's left-hand operand with respect to its right-hand operand and updates the left-hand operand with the result.


variable Integer num = 10;
num %= 2; // half num 



The %= operator is defined as follows:

lhs = lhs.remainder(rhs)

except that lhs is evaluated only once.

See the language specification for more details.


The %= operator is polymorphic. The definition of the %= operator depends on the Integral interface.


The result type of the %= operator is the same as the type of its right hand operand.

See also