Score counter problem

I am trying to make a score counter, the idea is to increase the score by one each time a button is clicked, I’ve set a global variable as the starting point with a value of zero and a list of buttons, though whenever a button is clicked the score increases by 3 instead of one, any suggestions will be appreciated :slight_smile:

blocks

You are missing an if/then in your loop.
If component is in list(global wrongAnswers) then
set score to score + 1

What your code does Alberto is Loop through the entire “wrongAnswers” List when a Button is tapped/clicked - so therefore, if the List has 3 items, the score is increased by 3. If the list had 100 items, the score would increase by 100 every time a button is tapped.

Thank you ABG and ChrisWard, I’ve managed to get my counter working based on your observations and the behavior I got is what I need:)

blocks(1)

1 Like