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 0" block. Change the value inthe dropdown to match one of your variable names. If you click the block, you'll seethe variable’s value change from the amount of votes registered to "0."
This only reset one value, so do the same steps for the other 3 values, choosing theappropriate variable name for each "set" block. Try it out. When you click the whole stack,all variables will be set to 0. A big part of computer science is persistingthrough 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 menuand using a "when this sprite clicked" event to start the code. You can read the stacklike a sentence now: "When this sprite clicked, set sneakers to 0, set high tops to 0, setpanda to 0, and set penguin to 0." Try it out. When the "clear votes" button is clicked,all of the votes are set to 0. Perfect! As your last step today, share your projectwith the Scratch community so others can experience your creative work. Don’t forget to adda description and some tags. Now it's your turn. Select the "clear votes"sprite, add code to set each of the variables to 0 when the button sprite is clicked. Whenyou are done with this step, ask a neighbor to take your fashion poll. Then, click thegreen arrow to choose some add-ons to customize your program.