Ages 8–10 · Challenge
Count after a reset inside a loop
Use the evidence in count after a reset inside a loop to select and justify a valid solution.
Understand the idea
Variables represent changing program state.
Your challenge
A total should count all collected tokens. Code sets total=0 at the start of EACH token event then adds that token’s value. After values 2 then 5 it shows 5. Which repair gives a running total?
- Display only the first token
- Initialise total once at game start instead
- Reset twice per token
How to explore
- Identify which statement destroys earlier state.
- Record the state after each executed operation, respecting the stated evaluation and stopping rules.
- Check the selected response against the complete situation, including a case where a tempting alternative fails.
Open the activity to work with its controls and check your reasoning. Progress stays in this browser.
Keep exploring
DON’T LET THE QUESTION END HEREGive that curiosity
Open the learning space