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

Amber Chunn
seal-mask
.a{fill-rule:evenodd;}techdegree
Amber Chunn
iOS Development Techdegree Student 6,203 Points

Error in Array's quiz?

I cannot see an error in my code. Works in xCode fine. Am I missing something, or is there an error in the quiz?

Keeps throwing "your 'todo' variable has the incorrect value" error

arrays.swift
var todo = ["Learn Swift", "Build App"]

todo.append("Deploy App")
todo.append("Fix Bugs")

let item = todo.removeAtIndex(2)

todo.insert("Learn iOS", atIndex: 1)

2 Answers

Devin Scheu
Devin Scheu
66,191 Points

Looks like you deleted the third item in the todo array causing the challenge to break. This is the code I got for this challenge:

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)

If you think my answer was good, feel free to mark it as best answer below, if you need more help in the future from me, you can contact me at devinwscheu@gmail.com.

Amber Chunn
seal-mask
.a{fill-rule:evenodd;}techdegree
Amber Chunn
iOS Development Techdegree Student 6,203 Points

Yeah, I was trying to see if that was the issue. It wasn't. It ended up being that the challenge didn't like a space between 'romoveAtIndex' and the (

Thanks!