O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Combination Assignment Operators

The following assignment, found in line 18 of Listing 9.6

height = height + 100;

as you know, increments the variable height by 100. Frequently, and in particular in connection with iteration statements, variables are incremented with a specific amount. C# offers a condensed way of writing this type of assignment through the plus-equals (+=) operator. It allows us to express the previous assignment statement as

where the left operand is added to the right operand (step 1) and the result is then assigned to the left operand (step 2).

C# contains five combination assignment operators, one for each of the binary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required