Understand the idea
An accumulator stores a running result. Initialise it before the loop, then update it once per item.
WORKED EXAMPLE
Start total = 0. For values 2, 4, 6, add each once: totals 0, 2, 6, 12.
Watch it step by step
Step 1 of 4Initialise
total = 0.
Choose Play to advance steps automatically.
Read or choose any step
- Initialise
total = 0.
- Item 1
Add 2; total = 2.
- Item 2
Add 4; total = 6.
- Item 3
Add 6; total = 12.
TRY BEFORE CHECKING
Exercises with feedback
MAKE SOMETHING YOU CAN EXPLAIN
Your practical challenge
Make a trace table for the list and for an empty list. Explain the initial value.
These ticks are your self-review. They do not automatically assess project quality. Ask an adult or partner to review what you can show.
Use the skill in a new situation
Adapt the trace to count only values above 3.