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!
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

Tyler Banks
3,109 PointsBuild a simple iphone app with Swift, creating a data model, challenge task 2 0f 2
We are at the grocery store and we picked up the bread. Using array subscripting, retrieve the string "bread" from the array and assign it to a variable named cart. My code:
var shoppingList = ["toothpaste", "bread", "eggs"]
var cart = shoppingList.removeAtIndex(1)
Bummer! You need to use subscripting to access the array element.
I can not figure out what is wrong in the last line of my code, it works in playground though. I would much appreciate a little help.
Petar Zelenovic
11,356 PointsPetar Zelenovic
11,356 PointsThe method "removeAtIndex" will remove the string "bread" from the array and assign it to the variable "cart", which is not the task you are assigned. Read carefully: "retrieve the string". It is only asking you to retrieve the string with the use of subscripting.
So, to do this, you need to access the string you want with the use of array index.
Hope this helps.