EXTEND #2: Let's update the value of rect_perim as we change the size of the rectangle!

  1. Inside mouse_move(), recalculate the value of rect_perim using x as the rectangle's width and y as the height. This updates the value of rect_perim each time the mouse moves!
  2. Add Update Display inside the event. Edit it to update the perimeter display with rect_perim.
  3. Click Run and try moving your mouse! Do you see the value of rect_perim changing?

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)