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 trialTravis Trevisan
5,846 Pointshaving problems passing the test, here is my code. todo.insert("Learn iOS", atIndex: 2) todo
// Playground - noun: a place where people can play
import UIKit
var todo = ["Learn Swift", "Build App", "Deploy App", "Debug App", "Fix Bugs"]
let item = todo.removeAtIndex(2) item
todo.insert("Learn iOS", atIndex: 2) todo
//it works in Xcode, just not on the site?
var todo = ["Learn Swift", "Build App", "Deploy App", "Debug App", "Fix Bugs"]
let item = todo.removeAtIndex(2)
item
todo.insert("Learn iOS", atIndex: 2)
todo
2 Answers
john dev.
Courses Plus Student 1,935 PointsHello Travis Trevisan. I am "sorry" if I misunderstood you. I think you forgot the "colon" in the first line. Here is my solution for you. I hope it helps you!
var todo: [String] = ["Learn Swift", "Build App", "Deploy App", "Debug App", "Fix Bugs"]
let item = todo.removeAtIndex(2) item
todo.insert("Learn iOS", atIndex: 2) todo
john
Travis Trevisan
5,846 Pointsthanks John and Alex!
John I've been using the same code that you demonstrated, no luck, I'm just going to move on, because the code I'm using works in Xcode!
Thanks for the help! - Travis
john dev.
Courses Plus Student 1,935 PointsOkay, I am "sorry". Good luck!
Alex Lobert
2,736 PointsAlex Lobert
2,736 PointsHi Travis,
Two thoughts:
todo.insert("Learn iOS", atIndex: 1)
todo += ["Debug App", "Fix Bugs"]
Hope that helps.
-Alex