Code Inspection: Use compound assignment
This inspection suggests using a compound assignment expression to make the code more concise and easier to read. Compound assignments are shorthand ways of combining arithmetic, boolean, bitwise, and other binary operators with the assignment operator
=. They can help reduce repetitive code and make the intent of the code clearer.
The most commonly used compound assignment expression is probably the addition assignment (
x += y), but there are other compound assignments that can come in handy. Here are some examples: