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

Error in 3rd quiz question for modifying array

The 3rd quiz question in "Modifying Arrays" ask for inserting "Learn iOS" at the 2nd place in todo . I am using todo.insert("Learn iOS", atIndex: 1) but its showing a bummer stating that your todo has wrong value in it. I think there is some error in this quiz question. Please look into this.

arrays.swift
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append ("Debug App")
todo.append("Fix Bugs")
todo.removeAtIndex(1)
let item = todo.removeAtIndex(1)
todo.insert("Learn ios", atIndex: 1)

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Nikhil,

As I mentioned in your other question (https://teamtreehouse.com/forum/error-in-the-quiz-answer), you have too much code than what the challenge is asking for. As I mentioned you should only be calling removeAtIndex once for the index of 2 which will allow you to insert the new string of Learn iOS into the todo array.

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)

NOTE: The challenge is case sensitive so you will need to ensure that words such as iOS are spelled as per what the challenge mentions or it won't pass.

Happy coding!

Hi Chris Yes just changes the iOS to lower case and it took it, thanks