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?

Im Stuck on Swift Basics Collections

I'm trying to print out todo but I am having problems doing that. It also says that I need to use todo.count, but I don't know why.

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

todo.count

println\(todo)

I believe you would just need to print out the array like this

println(todo)

The key to solving this is using Loops, perhaps re-watch those videos. Here is an example of looping over the array and printing each item:

for item in todo {
   println("Current Item => \(item)")
}

To use todo.count you will need to create a for loop with a counter.

1 Answer

Max Hirsh
Max Hirsh
16,773 Points

Hey simondumalski,

Your answer is really close. All you need to do is directly print "todo.count", not just call it in the previous line. println works for both numbers and strings.