What does the %= operator do? [duplicate]

From MSDN:

The % operator computes the remainder after dividing its first operand by its second. All numeric types have predefined remainder operators.

So in your case, the following string

a %= b;

is the same as this one:

a = a % b;

Which also applies to all operators:

a += b equals to a = a + b
a /= b equals to a = a / b
a -= b equals to a = a - b
etc.

Leave a Comment