STEP 2: Let's identify pieces of our code that can be reused more than once!

  • Look at the code. Find the first series of commands that are used more than once.
  • Place a #comment on the line above the beginning of the first section of code that is used more than once.
  • Place a #comment on the line below the end of the first section of code that is used more than once.

Code that is used repetitively can be placed in a function. Then, the function can be called more than once!

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)