Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Augmented assignment
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Refimprove|date=September 2014}} '''Augmented assignment''' (or '''compound assignment''') is the name given to certain [[Assignment (computer science)|assignment]] [[operator (programming)|operator]]s in certain [[programming languages]] (especially those derived from [[C (programming language)|C]]). An augmented assignment is generally used to replace a statement where an operator takes a [[Variable (programming)|variable]] as one of its arguments and then assigns the result back to the same variable. A simple example is <code>x += 1</code> which is expanded to <code>x = x + 1</code>. Similar constructions are often available for various binary operators. In general, in languages offering this feature, most operators that can take a variable as one of their arguments and return a result of the same type have an augmented assignment equivalent that assigns the result back to the variable in place, including arithmetic operators, bitshift operators, and [[bitwise operation|bitwise operators]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)