The Accumulator PatternΒΆ




(sq_accum1)

This pattern of iterating the updating of a variable is commonly referred to as the accumulator pattern.

Here is the same program in codelens. Step through the function and watch the “running total” accumulate the result.

(sq_accum3)

Next Section - Functions can Call Other Functions