For a code question: What it wants is for you to make a for loop that will run down the length of the array it provides. We're going to keep track of where we are in the array with our counter variable. At the end, we should have the sum of all the numbers in that array.
I don't understand why my 2nd loop cannot iterate over the whole array, also how do I check the sum, would that just be printing the sum?
let numbers = [2,8,1,16,4,3,9]
var sum = 0
var counter = 0
while sum < numbers.count {
print(numbers[sum])
sum += 1
}
while counter < numbers.count {
sum = sum + numbers[counter]
print(numbers[counter])
counter += 1
}