|I would do something like sum+=arrayname|
Beware of mixing apples and oranges.
one assumes is an integer.
is not clear, but it might be supposed to be a string. You wouldn't want to add a string to an integer. Don't mix apples and oranges.
|could you give me a rough example of what counting would look like?|
You have an example of counting in your own code:
i = i + 1
) simply adds 1 to a variable.
is used to count the iterations of the loop. It does that by adding 1 to the variable each time an iteration is completed.
You would need to use a different variable. Set it to zero before you begin. Add 1 to it each time you find something that you are counting, whether it be a sheep or a loop iteration or a correct answer.
When there are no more sheep or answers to be counted, the final value of your variable is the total.
(Sorry about the references to sheep - I wanted to make this a general rather than a specific answer, and "counting sheep" was the first thing which came to mind).