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 trialKyle Li
564 PointsNot sure what I'm doing wrong here
What is wrong with my constant?
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append ("Debug App")
todo.append ("Fix Bugs")
Let item = todo.removeatindex (2)
2 Answers
William Li
Courses Plus Student 26,868 PointsHi, Kyle Li
There're several problems in the final line of your code
- it's
let
, notLet
, do not capitalize the keyword. - the method name is
removeAtIndex
, notremoveatindex
; again, capitalization matters. - finally, not a syntax error, but it's best practice not to put a space between method and its argument, in this case -- removeAtIndex and (2)
let item = todo.removeAtIndex(2)
Hope this helps, let me know if you have further question, cheers.
Adam Griffith
1,742 PointsRemoved as it was wrong. : )
William Li
Courses Plus Student 26,868 PointsHi, Adam, the index is correct here, the problem this code has is the misspelling of keyword and method name.