Snap! can be used to wait
for a certain time before reporting anything. Snap! also allows us to
do the converse: to report how long a program takes to finish. In the Sensing
menu, you will see a command called reset timer
and a reporter called timer
:
timer
reporter and you should see a timer ticking away in the top left
corner. It's been ticking ever since you opened up Snap! , and
counts in tenths of a second:Hello!
for 1 second, and soon after that, the sprite will say the current time, less 1 second to account for how long the sprite said Hello!
. If we replace Hello!
with a reporter, then the sprite will say the answer of the reporter,
and one second later, how long the reporter took to generate the
answer: this is the timing information that we need. Save the
script with the name TimingFramework
.