Creating a quiz (How to tally up results and display a final score)

Good work so far. Regarding the calculation, I would run it on clicking a submit button, a) because the user knowa that they have finished the quiz and shouldn’t be changing answers anymore and b) it allows the quiz to check that every question has been answered.

You then have two options. The first is abit long which is to have a case which adds every score and then presents it. The benefit of this this is that you piggy back this case with an “If” cae which checks to see that an option for each question has been selected. The second quicker option is to have a global variable which gets updated whenever an answer is clicked. Some will add 1, others will keep the number the same. Again, you won’t an “If” case that checks that an option for each question has been selected.

Hopefully this help?