## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Trying to satisfy the code challenge: Working with While ... While Loops. Here is my code:

let numbers = [2,8,1,16,4,3,9] var sum: Int = 0 var counter: Int = 0 while counter < numbers.count { sum = sum + numbers[counter] counter++ } print (sum)

Sorry, My paste did not fully get transferred. I will try again.

Got the challenge to accept my code! Apparently, as with the problem here, I must have had some keystrokes invisible to the eye in my cut-n-paste. I manually typed my code into the challenge and it was happy.

Another attemp at pasting my code:

let numbers = [2,8,1,16,4,3,9]

var sum: Int = 0

var counter: Int = 0

while counter < numbers.count {

```sum = sum + numbers[counter]

counter++
```

}

print (sum)

OK . . . third attempt to put my code in. Paste leaving lines out. Suppose I must enter each line manually:

let numbers = [2,8,1,16,4,3,9] var sum: Int = 0 var counter: Int =0 while counter < numbers.count { sum = sum + numbers[counter] counter++ } print(sum)

For some reason the conditional did not show up again in the while statement. This editor does not appear to like the "less than symbol" so I will not actually use it, instead I will put the symbols in quotes.

I have the following: while counter "less than symbol" numbers.count then the "left curly bracket" sum = sum + numbers[counter] counter++ "right curly bracket" print(sum)