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 trialJosuel Garcia
6,069 PointsWhat is wrong here or is a bug
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App", "Fix Bugs"]
todo.removeAtIndex(1)
let item = todo.removeAtIndex(1)
todo.insert("Learn ios", atIndex: 1)
2 Answers
Chris Shaw
26,676 PointsHi Josuel,
You're getting an error because you're removing one too many values from the dictionary. Instead you just want to remove the second index which is Deploy App.
let item = todo.removeAtIndex(2)
Steve Smith
12,955 PointsThere doesn't seem to be anything wrong with that code. What issue are you having, or what do you think is a bug?
Josuel Garcia
6,069 Pointsi keep getting the same "wrong value error"
Steve Smith
12,955 PointsWhat version of Xcode? Have you quit and restarted Xcode? Tried creating a new, empty Playground?
Josuel Garcia
6,069 Pointsit was actually in one of the challenges task 3
Steve Smith
12,955 PointsSorry Josuel - I should have clued in to this being a code challenge. Chris Upjohn has this one covered I think!
Josuel Garcia
6,069 PointsI figured it out, the real issue was the first task it should have never let me pass with "+=" I had to append each one separately.
Josuel Garcia
6,069 PointsJosuel Garcia
6,069 Pointsi tried that but it let me pass task 2 with the code i already have
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsTask 2 shouldn't have passed as the array would have been missing Build App which is required, however in saying that the only other issue is you have written iOS in all lower-case which the challenge isn't looking for.
Josuel Garcia
6,069 PointsJosuel Garcia
6,069 PointsI figured it out, the real issue was the first task it should have never let me pass with "+=" I had to append each one separately.