Compound Operators
Nerd Cafe
What are Compound Operators?
x = x + 5x += 5Syntax Overview
Operator
Meaning
Equivalent to
Step-by-Step Guide with Examples
1. += Add and Assign
+= Add and Assign2. -= Subtract and Assign
-= Subtract and Assign3. *= Multiply and Assign
*= Multiply and Assign4. /= Divide and Assign
/= Divide and Assign5. //= Floor Division and Assign
//= Floor Division and Assign6. %= Modulo and Assign
%= Modulo and Assign7. **= Power and Assign
**= Power and Assign8. Bitwise Compound Operators (advanced but useful)
Summary Table: Quick Reference
Compound Operator
Meaning
Example (x = 4, y = 2)
Result
Keywords
Last updated