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 trialLogan Standard
1,015 Points1st Challenge Question - Swift 2.0 Basics
Declare a variable named language and assign the string "Swift". We didn't go over the specific syntax for creating a String so remember to start with a double quote, write the word, and close it with a double quote.
This is my answer:
var str = "language"
str = "Swift"
When I attempt to put my code in the complier it says there are errors but when I check the editor no errors show up, then it times out.
I just want to make sure this is the correct answer.
// Enter your code below
var str = "language"
str = "Swift"
3 Answers
Caleb Kleveter
Treehouse Moderator 37,862 PointsThe challenge wants you to create a variable called language and assign the string "Swift" to it, like this:
var language = "Swift"
See the difference?
Jennifer Nordell
Treehouse TeacherYour code here takes a variable named str and assigns the string literal "language" to it. Then it overwrites that value with the name "Swift". What they intended was for you to make a variable named language and assign the string literal "Swift" to it. Take a look:
var language = "Swift"
Logan Standard
1,015 PointsJennifer, Caleb - I completely understand now -____- I was reading it wrong is all. I appreciate both of your timely responses!
Thanks again,
Logan
Caleb Kleveter
Treehouse Moderator 37,862 PointsGlad you figured it out! Be sure to mark the best answer!