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
Strings and arrays
I don't know whats wrong with my code. Can anyone solve this ?
This is what te console said: The
favoriteSports variable was expected to be a array of strings (aka
[String]), but it wasn't.
let bestSmartphone = "iPhone" var favoriteSports: String = "football"
It should look like this:
let bestSmartphone = "iPhone" var favoriteSports = ["football", "basketball", "tennis"] favoriteSports.append("volleyball")
let bestSmartphone = "iPhone" var favoriteSports = ["football", "basketball", "baseball"]
An array is encased in 
What you wrote is:
var favoriteSports: String = "football"
This just means that you want favorite sports array to be a explicative type of string with the value being football. In english what you said is "My favorite sports are football." Hope this helps.
David Maybach2,092 Points
I was doing this:
var favoriteSports = ["football","basketball","tennis"] println ("\(favoriteSports), volleyball")