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 What is an Array?

I believe I am answering this question correctly with the println("The number of items in my todo list is \(todo.count)"

The question asks print out the number of items on the todo list using println, I answer essentially with println("number of do list items is (todo.count)") and I keep getting Bummer Try Again. It would seem you're looking for use of .count, but what is missing from this?

var todo : [String] = ["Learn Swift","Build App","Deploy App"]
println("The number of items is \(todo.count)")

2 Answers

That's the compiler being picky - you just need println(todo.count)

At times, the tests behind the code challenges are narrowly interpreted!


Thanks Steve, I just found the other answer, I should have searched the forum first. Again thanks for the answer, I was trying to be all smart and use interpolation and format my answer. :)

There are many examples where the simplest answer is what it is looking for - added flair and style isn't the way forward when it comes to the code challenges!!