Please enable JavaScript to use CodeHS

IB Computer Science Standard Level

Lesson 7.4 Compound Assignment Operators

Description

In this lesson, students will learn how to use the increment operator (++), the decrement operator (--) and compound assignment operators (+=, ?=, *=, /=, %=). The increment operator (++) and decrement operator (??) are used to add 1 or subtract 1 from the stored value of a variable. The new value is assigned to the variable. This lesson corresponds with AP Computer Science A topic 1.4.


Objective

Students will be able to:

  • Evaluate what is stored in a variable as a result of an expression with an assignment statement
  • Use a compound assignment operators (+=, ?=, *=, /=, %=) in place of the assignment operator
  • Use an increment operator (++) or decrement operator (??) to add 1 or subtract 1 from the stored value of a variable