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?

Harrison Merkt
Harrison Merkt
1,659 Points

I was not taught this and the functions I know are not working.

It is asking mer to print out the number of items in array "todo" using the ".count" function and println. I know println and wrote:

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

print; todo.count

that didn't work so I did this:

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

var todoNum = todo.count

println; todoNum

This worked in Xcode and printed the number I was looking for but the workspace challenge keeps telling me I'm wrong.

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

todo.count

println; 3

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Oh so close! Remember in println we say println and then what we want to print. I'm not sure where your semicolon is coming from :smiley: Take a look:

var todo = ["Learn Swift", "Build App", "Deploy App"]
println(todo.count)