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.

Darrell Conklin
21,122 PointsThis should pass but it doesn't
var results: [Int] = []
for n in 1...100 {
// Enter your code below
if (n % 2 != 0) && (n % 7 == 0) {
results += [n]
}
// End code
}

Darrell Conklin
21,122 PointsWell that definitely worked thank you though += hasn't been deprecated it was ++ and --. They even use it in the examples in the course, I really just think someone forgot to add the proper check when they wrote this code challenge.
1 Answer

kjvswift93
13,515 Pointsvar results: [Int] = []
for n in 1...100 {
// Enter your code below
if (n % 2 != 0) && (n % 7 == 0) {
results.append(n)
}
// End code
}
Luke Maslany
3,545 PointsLuke Maslany
3,545 PointsYou’re almost there. Try appending the result to the results array using: results.append(n)
Note: I believe that the method you were trying to use to append results used to work with older versions of Swift - but it has since been depreciated.
Addendum: as noted by Eliyah - it seems I may be mistaken about the depreciation of the additional assignment operator: +=