Topics / Programming / Counting and Totalling

Counting and Totalling

It is important to understand the difference between totalling and counting.


Counting

Counting is used to find how many numbers or items there are in a list.

Counting can keep track of how many iterations your program has performed in a loop.

In the above example, the new value of the Counter variable is the old value, plus an additional 1.


Totalling

Totalling is used to sum a list of numbers.

In the above example, the new value of the Total variable is itself, plus an additional value (contained in the variable called Number).

Topics / Programming / Counting and Totalling