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.

iOS Swift Collections and Control Flow Introduction to Collections Working With Arrays

Caden Nichols
Caden Nichols
389 Points

It says Task 1 is no longer passing

When I enter my appended and concatenated arrays it will not let me move on to the next part of the task stating that "Task 1 is no longer passing" (Task one was to declare a variable named arrayOfInts and assign 6 numbers to it)

When I do this in playground it does not say this. Is this an actual issue or just a treehouse glitch?

array.swift
// Enter your code below
var arrayOfInts: [Int] = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts = arrayOfInts + [8,9,]

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! This is neither a syntactical error nor is it the result of a "glitch" in Treehouse. It is simply a misunderstanding of the instructions. After you use the append method to add an item, there is another instruction:

Next, add another item to the array by concatenating an array. When concatenating, assign the results of the expression back to arrayOfInts.

You're doing the concatenation just fine, but you're adding two additional elements to the array where it only asked for one. Also, the trailing comma inside the brackets is not needed. Changing the [8,9,] to [8] causes this code to pass the second step.

Hope this helps! :sparkles: