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 trialJoe Nelson
284 PointsWhy does it say my todo var has wrong value?
Says "your 'todo' variable has wrong value in it"?
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App","Fix Bugs","Learn iOS"]
todo.removeAtIndex(1)
let item = todo.removeAtIndex(1)
todo.insert("Learn iOS", atIndex: 1)
1 Answer
Chase Marchione
155,055 PointsHi Joe,
1) Looks like you're appending "Learn iOS" twice. When you do your insert in the third part of the challenge, that is the only time you'll need to append it--no need to hard code it in your first statement, adding an extra string.
2) You have two removeAtIndex function calls, and you're currently removing the second string. We want to remove the third string.
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App","Fix Bugs"]
let item = todo.removeAtIndex(2)
todo.insert("Learn iOS", atIndex: 1)
Hope this helps!
Joe Nelson
284 PointsHey CJ,
Thank you for the answer! I think there may be a bug with that challenge because it would not let me move on from task two with
let item = todo.removeAtIndex(2)
Thank you for your help!
Joe Nelson
284 PointsJoe Nelson
284 Points**** "Learn iOS" is not supposed to be in the second line