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 trialfrederickparas
553 PointsChallenge Question 2 of 3: - arrays.swift
Getting this error message - Bummer! item
should have the value "Deploy App" but is Debug App
My answer below: var todo = ["Learn Swift", "Build App", "Deploy App"] todo.append("Debug App") todo.append("Fix Bugs") todo.removeAtIndex(2) let item = todo.removeAtIndex(2)
What am I doing wrong.
3 Answers
Jed Bradshaw
6,053 Pointslet item = todo.removeAtIndex(2)
Ramiro Aguirre
Courses Plus Student 16,725 Pointswhen you remove a value then call it in a constant the constant will point to the wrong value so remove the
todo.removeAtIndex(2) hope it works
frederickparas
553 PointsThank you.
William Crawford
4,319 PointsFrederick, Agree with Ramiro. You were close. Just delete your penultimate line - todo.removeAtIndex(2) Your final line combines the two - let item = todo.removeAtIndex(2) . The way you wrote it, the third item was already removed before you assigned "item" to the third item, which was no longer "Deploy App", but was now "Debug App."
frederickparas
553 Pointsfrederickparas
553 PointsThank you