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 trialCaden Nichols
389 PointsIt 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?
// Enter your code below
var arrayOfInts: [Int] = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts = arrayOfInts + [8,9,]
1 Answer
Jennifer Nordell
Treehouse TeacherHi 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!