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

Why make removed items from an array list to a constant?

So on this challenge, i had to make a todo list, append two items to it, remove an item from it and assign that removed item into a constant. Why would i do this in the first place? what is the purpose of taking that removed item and assigning it to a constant?

var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append ("Debug App")
todo.append ("Fix Bugs")
let item = "Deploy App"
Matt Miller
Matt Miller
2,043 Points

Imagine you are building a todo list app for iPhone. You may want to save a list of recently removed items at the bottom of your list, in which case assigning those items to a new array would be useful in case you want to "undo" those items.

1 Answer

William Li
William Li
Courses Plus Student 26,868 Points

Hi, Jesus Lopez , since similar questions about this challenge have been asked quite a few times before, I ask you to check out this post https://teamtreehouse.com/forum/finally-we-forgot-to-add-that-we-need-to-learn-ios-development-prior-to-building-an-app, it has the answer to your question.