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!

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?

Works in xcode but does not let me pass the challenge

I wrote println("(todo.count)") and it showed no errors in xcode. However when i wrote the same thing in the challenge it rejected it, i checked in xcode if it outputted, i opened the console and in both the output pane and the console it said 5. With the only exception that in the output pane it had "" around the 5

var todo = ["Learn Swift","Build App","Deploy App"]
Roland Shen
Roland Shen
7,628 Points

Wouldn't this give you a 3 instead of 5 because there's only 3 items in the array? Check the directions of the challenge to see if it had any more steps for you to follow.

In the xcode playground i had 5 strings in the array. So that's why, and this was the only objective they gave me: Print out the number of items in the todo array using println.

1 Answer

var todo = ["Learn Swift", "Build App", "Deploy App"]

Thank you for your response!