We need to know if our script works, so let's define the variables to values other than zero:
As you run the script, don't forget to click the flag to reset your calculations. Enter a new startAmount and press the Space bar to calculate the value.
If you look at the monitor blocks on the stage, you'll notice every block has a value. Did you notice a pattern in your calculation? If not, rerun the script using the values 1, 2, and 4. If we double the startAmount, the newAmount doubles as well.
Clicking the flag offers an easy way to reset our calculation, and I'd be willing to bet that you tried to press the Space bar once or twice without clicking the flag first. You'll note that nothing happened. That's because the value of count already equaled the value of days.
The slider control we added to the startAmount monitor provides a user-friendly way to set an initial number and interact with the program. The bigger the number in startAmount, the bigger the final value in newAmount will be.
For example, if we start with four chicken feet, we would end up with 256 chicken feet after seven days. That's a lot of scratchin'.
The slider can also accept decimal values to the tenths position. To enter decimals, specify the decimal value in the min and max values of the set slider min and max control (e.g., Min: 0.1 and Max: 5.0).
Let's inspect our calculation using the single stepping feature of Scratch.
3.15.229.143