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

Matthew Darragh
Matthew Darragh
205 Points

Understand array from another course, works on Xcode, do task two on here and it tells me task 1 is broken!

any reason?

Please provide your code and I can help you out :)

Actually, there might be a Syntax error in your code.

Since the challenge goes through all the tasks you've done if you complete one task.

Example:

TASK 1: Only checks task 1

TASK 2: the code challenge checks if task 1 AND task 2 pass

TASK 3: The code challenge check if 1, 2, and task 3 all pass

If there's a syntax error, the program automatically crashes and task 1 doesn't pass and that's why it will say "Oops! Task 1 isn't working".

Matthew Darragh
Matthew Darragh
205 Points

var arrayOfInts = [1,2,3,4,5,6] arrayOfInts.append(7) arrayOfInts.append(8) arrayOfInts = arrayOfInts + [9]

1 Answer

It seems that you used two appends when the challenge was asking for one. The concatenation looks fine.

Try this:

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

arrayOfInts.append(8)
arrayOfInts = arrayOfInts + [9]

I hope this helps. ~Alex