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 Swift Collections and Control Flow Introduction to Collections Working With Arrays

Paolo Di Donato
Paolo Di Donato
4,945 Points

Error caused in challenge 2 of 4 from code in challenge 1 of 4.. after passing challenge 1 with no problems..

I have passed step 1 in collections and control flow - when I am doing the testing I seem to challenge task 1 with no problems but when I go to submit challenge 2 of 4 I get an error the there is something wrong in step 1.. So I go back to challenge 1, resubmit and go to challenge 2 and the same thing continues to happen..

Is there a problem on treehouses end? I put the code into playground and there are no issues with it.

var arrayOfInts: [Int] = [0,1,2,3,4,5]



arrayOfInts += [8,9]

// Enter your code below

var arrayOfInts = [0, 1, 2, 3, 4, 5]

1 Answer

So the question is actually asking you to add a single item via the append method and a single item via concatenation

There isn't an issue with your code or treehouse, just with what the questions is asking.

So per your code:

var arrayOfInts: [Int] = [0,1,2,3,4,5]


arrayOfInts.append(7) // This line is not needed

arrayOfInts += [8,9] // You should only concat a single value such as [8]

Give that a try.