Step 8: Renaming the Sliders

Goal:


The last thing we need to do now is to rename our Sliders.

Giving objects in our code good descriptive names is very important for when we begin to program.

Good names allow us to distinguish which object is which. For example right now we have 2 sliders, how do we know which one is which? Sure you can always memorize it, but what happens when we have 10 sliders? 100 sliders? Naming things is important.

Here we really only need to rename our Sliders since every other thing is unique. However, feel free to rename everything if you’d like! Doing so is very good practice.

Steps:

  1. On the components list, click on Slider1.
  2. At the very bottom of the components list, click on the “Rename” button.
  3. Rename Slider1 to “PitchSlider”.
  4. Repeat this for Slider2 and rename it “SpeedSlider”.

Code:


Click to replay