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

Adebiyi Dayspring-Adenusi
Courses Plus Student 57 PointsString favoriteColor = "black"; what is wrong with the above line of code
Tried running this in the compiler but gave me the "bummer" notification
favoriteColor String equals "";
String favoriteColor = "black";
4 Answers

Alexandra Kaplan
1,167 PointsI'm guessing from my Swift knowledge, but I think it's supposed to be:
favoriteColor:String="black"
OR
favoriteColor[String]="black"
when you are identifying something as a string you have to use a precursor

Seth Kroger
56,409 PointsYour second line is how it should be in Java. Remove the first, because it's not valid Java syntax, and it should be fine.
Also, if it isn't obvious, Swift is not Java.

Adebiyi Dayspring-Adenusi
Courses Plus Student 57 Pointsthanks guys. Found out that the error was in my lack of spacing between the semicolon and quotation mark

Samuel Karki
206 Pointsstring favouriteColor = "Black"