Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Collections and Control Flow Swift 3: While Loop Exercise 1 & 2

To anyone else having a problem with the exercise in part 2 of Collections and Flow Control (While Loops), get rid of the code you did in part one or it might not take your code in part 2! I wasted 3 hours trying to figure out what was happening and I finally deleted the code from part 1 and it finally took my answer.

My code from part 1: (Try deleting before submitting part 2!! )

while sum < numbers.count { print(numbers[sum]) sum += 1 }

Code for part 2:

while counter < numbers.count { sum += numbers[counter] counter += 1 }