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

Challenge Question 2 of 3: - arrays.swift

Getting this error message - Bummer! item should have the value "Deploy App" but is Debug App

My answer below: var todo = ["Learn Swift", "Build App", "Deploy App"] todo.append("Debug App") todo.append("Fix Bugs") todo.removeAtIndex(2) let item = todo.removeAtIndex(2)

What am I doing wrong.

3 Answers

Jed Bradshaw
Jed Bradshaw
6,053 Points
let item = todo.removeAtIndex(2)

Thank you

when you remove a value then call it in a constant the constant will point to the wrong value so remove the

todo.removeAtIndex(2) hope it works

Thank you.

William Crawford
William Crawford
4,319 Points

Frederick, Agree with Ramiro. You were close. Just delete your penultimate line - todo.removeAtIndex(2) Your final line combines the two - let item = todo.removeAtIndex(2) . The way you wrote it, the third item was already removed before you assigned "item" to the third item, which was no longer "Deploy App", but was now "Debug App."