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 trialEvan Eshel
7,002 PointsHi, I am trying to do the challenge and it keeps on saying, "Bummer1 You need to define team let. Help me please!
Why would it want me to define item when I do not have it?
~thanks
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App", "Fix Bugs"]
todo.insert("Learn iOS", atIndex: 1)
1 Answer
Stone Preston
42,016 Pointsthe task states: Please remove the third item ("Deploy App") and assign it to a constant named item.
according to the documentation, swift arrays have a method called removeAtIndex:
removeAtIndex(_:)
Removes the element at the given index and returns it.
so we can remove the item and assign that item that was removed to a constant in one step:
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
let item = todo.removeAtIndex(2)