1.4 Compound Assignment Operators
Enduring Understanding
The way variables and operators are sequenced and combined in an expression determines the computed result.
Learning Objective
Evaluate what is stored in a variable as a result of an expression with an assignment statement.
Essential Knowledge
Compound assignment operators (+=, −=, *=, /=, %=) can be used in place of the assignment operator.
The increment operator (++) and decrement operator (−−) are used to add 1 or subtract 1 from the stored value of a variable or an array element. The new value is assigned to the variable or array element.
Exclusion Statement: The use of increment and decrement operators in prefix form (i.e., ++x) and inside other expressions (i.e., arr[x++]) is outside the scope of this course and the AP Exam.
Last updated
Was this helpful?