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 trialBao Pham
Courses Plus Student 240 PointsHelp on this Array challenge?
"Print out the number of items in the todo array using println. Part 2 challenge"
Says I have to "Call" the count. When I get the answer wrong.
So, I attempted to write println(todo.count) within the box brackets because the challenge say "in the todo (array) using println." I wrote the println() function in the beginning of the box brackets with a comma at the end.
I am completely stuck as I don't understand where else to type the function.
var todo = ["Learn Swift","Build App","Deploy App"]
5 Answers
Bao Pham
Courses Plus Student 240 PointsSo apparently I was right and so were all of you except we all forgot one symbol. The semi-colon.
It was supposed to be this.
var todo = ["Learn Swift", "Build App", "Deploy App"]; println(todo.count)
I don't even remember the video showing use of that symbol. I will go back and check the video again.
AR Ehsan
7,912 PointsTry! var todo = ["Learn Swift", "Build App", "Deploy App"] println(todo.count)
AR Ehsan
7,912 Pointsvar todo = ["Learn Swift", "Build App", "Deploy App"] println(todo.count)
Bao Pham
Courses Plus Student 240 PointsI've tried all the above answers. I get this in response.
You need to call the 'count' method on the array.
Bao Pham
Courses Plus Student 240 PointsSo apparently I was right and so were all of you except we all forgot one symbol. The semi-colon.
It was supposed to be this.
var todo = ["Learn Swift", "Build App", "Deploy App"]; println(todo.count)
I don't even remember the video showing use of that symbol. I will go back and check the video again.
Deron Rowlands
801 PointsDeron Rowlands
801 PointsYou don't need to use box brackets with a println, just curly ones.
The correct answer is simply: println (todo.count)