Please update your browser
Your browser version is not supported by this site. CS First may not work properly. Learn more.
In this video, you'll program
the Clear Votes button to set all votes back to zero.
Select the Clear Votes sprite
that was included in the starter project.
Click the Data menu and drag out
the set variable to zero block.
Change the value in the dropdown
to match one of your variable names.
If you click the block, you'll see variables value change
from the amount of votes registered to zero.
This only reset one value
so do the same steps for the other three values,
choosing the appropriate variable name for each set block.
Try it out.
When you click the whole stack
all variables will be set to zero.
A big part of computer science
is persisting through tough problems.
If the first solution you try doesn't work, try again.
Next, connect this block stack to the Clear Votes button
by clicking on the Events menu
and using a when this sprite clicked event
to start the code.
You can read this stack like a sentence now.
When this sprite clicked set Sneakers to zero,
set Hightops to zero, set Panda to zero
and set Penguin to zero.
When the Clear Votes button is clicked
all of the votes are set to zero.
Now it's your turn.
Select the Clear Votes sprite.
Add code to set each of the variables to zero
when the button sprite is clicked.
When you're done with this step
ask a neighbor to take your fashion poll.
Then click the green arrow to choose some Add-Ons
to customize your program.
Sign in to track your progress and earn badges