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 trialphilippe godfroy
596 PointsChallenge task 2 of 3. I'm stuck. I did: let item = todo.removeAtIndex(3) but this isn't correct. Some help on the answr
Can't find the problem?
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App", "Fix Bugs"]
let item = todo.removeAtIndex(3)
let item = ["Deploy App"]
2 Answers
Ian Burres
250 PointsI'm not sure what the rest of your code looks like (since I haven't used Swift nor do I know what you are working on), but if you want to remove Deploy App, then you need to do: todo.removeAtIndex(2). Remember, arrays start at index 0, and since I just looked it up, I know Swift follows this rule.
Ian Burres
250 PointsI'm not familiar with Swift, but I am an experienced programmer. When you run the code, is it removing Debug App instead, or is it failing to compile?
Ian Burres
250 PointsYou're welcome.
Ian Burres
250 PointsIan Burres
250 PointsIf this does not solve your answer, please be a little more specific. Maybe I can help...maybe I can't, :)
philippe godfroy
596 Pointsphilippe godfroy
596 PointsAbsolute hero! Thank you, my coding was correct, but the index which I gave "3" had to be "2"! I just forgot the arrays starts at 0... Thank you my friend