DEMO: This demo shows how you can increment (increase) a variable's value repeatedly inside a loop!

Using += or -= in a loop increases or decreases a variable's value by a set amount each time the loop runs.

  • Click Run and watch the code in the code editor run. Then, follow along through the demo that explains it!
  • Take a close look at the code on the stage and in the code editor. Do you see where += is used?

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)