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 trialLing Cheng
3,168 Pointswhat happen?
Am I doing anything wrong? I could get the result on Xcode but not here, it says my 'todo' variable has the wrong value in it
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
todo.removeLast()
let item = todo.removeAtIndex(2)
todo.insert("Learn IOS", atIndex:1)
1 Answer
William Li
Courses Plus Student 26,868 PointsHi, Ling
Looks like there's one extra line there in your code
todo.removeLast()
Remove it and things should be good to go. It's important that when copying the codes over from Xcode, DO NOT copy all the lines over all at once!! That'd guarantee to fail because the list elements mismatch; only copy over the lines necessary to get pass each part of the challenge.
Also, I'd like to point out is that when you're testing the code on Xcode in your local machine, it may run fine without generating any errors, but that doesn't mean it'd pass the Code Challenge's check, the grader can be very strict sometimes, the code may fail the grader unless it does exactly what the Challenge asks.
Ling Cheng
3,168 PointsLing Cheng
3,168 PointsGot it, thanks very much!!
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 Pointsno problem, let me know if you have further questions.