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?

David Sheppeard
PLUS
David Sheppeard
Courses Plus Student 550 Points

how to call 'count' on an array

i am having trouble printing out the number of items in my array with the todo.count.

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

println = todo.count 

1 Answer

John Wilson
John Wilson
12,845 Points

Here is the answer! Just small formatting change :-)

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

println(todo.count)
Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

John Wilson , I thought I might let you know I changed your comment to an answer. This allows you to be up-voted, and awarded with best answer!

David Sheppeard
David Sheppeard
Courses Plus Student 550 Points

cheers John, it was late last night here in OZ and it was doing my head in :)

John Wilson
John Wilson
12,845 Points

Thank you Caleb! Cheers guys.