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 trial

iOS Swift Basics (retired) Collections Modifying an Array

Not sure what I'm doing wrong here

What is wrong with my constant?

arrays.swift
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
PLUS
William Li
Courses Plus Student 26,868 Points

Hi, Kyle Li

There're several problems in the final line of your code

  • it's let, not Let, do not capitalize the keyword.
  • the method name is removeAtIndex, not removeatindex; 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.

Removed as it was wrong. : )

William Li
William Li
Courses Plus Student 26,868 Points

Hi, Adam, the index is correct here, the problem this code has is the misspelling of keyword and method name.