CSharp examples for Language Basics:Operator
Operator | Description | Noncompound Equivalent |
---|---|---|
+= | x += 4 | x = x + 4 |
-= | x -= 4 | x = x ? 4 |
*= | x *= 4 | x = x * 4 |
/= | x /= 4 | x = x / 4 |
%= | x %= 4 | x = x % 4 |
For example, if you want to increase a value by 5, you use the following:
x = x + 5;
Or, you can use the compound operator:
x += 5;