Time for action – label newAmount
We will once again compare the days and count values as a way to determine if we should perform an action. This time, we want to know when to display the value in the newAmount variable:
Select the double sprite from the list of sprites.
Add a second when space key pressed control block to the scripts area.
Add a wait until block to the when space key pressed block.
We want to wait until count = days before we run our code. Add the = block to the wait until block.
From the Variables palette, add the count block to the left side of the equals block and the days block to the right side of the equals block.
From the Looks palette, add the say block to the wait until block.
We want to report the value in the newAmount variable, so drag the newAmount block into the say block.
Run the script. The final value displays in a speech bubble on the screen.
What just happened?
If we started with one dog bone and doubled it every day for seven days, we would have ended up with...