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 trialMarco Leo
1,007 PointsWhat does it mean your 'todo' array has the wrong value in it?
I added to my Array "learn ios" in the second position and its telling me i did it wrong. ex: todo.insert("Learn ios", atIndex: 1)
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
let item = todo.removeAtIndex(2)
todo.insert("Learn ios", atIndex: 1)
2 Answers
Michael C
3,230 PointsYou might just be able to insert a new string to a index which is empty. As I can see in your code your Index[2] might be empty because you called the "removeAtIndex(2)" method. Try to insert it into the Index 2 instead of Index 1 as you did in your Insert Method
kjvswift93
13,515 PointsPerhaps because it is supposed to be iOS not 'ios'. This is the answer.
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
let item = todo.removeAtIndex(2)
todo.insert("Learn iOS", atIndex: 1)
Marco Leo
1,007 PointsHey Thanks for for your help, I knew i had it right cant believe i didn't see that.