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 trialRonald Todman
1,487 PointsAssigning the string called "Swift" to var "language" using the str = "Swift" but command but it is not link to var
Good Day everyone I am Assigning the string called "Swift" to var "language" using the str = "Swift" command but it is not linked. var str = "language" str = "Swift" I read the error code in which it pointed out adding ";" So I var str = "language" str ; "Swift "
Can someone point out where I went wrong? Thanks
// Enter your code below
var str = "language"
str = "swift"
3 Answers
tromben98
13,273 PointsGood day Ronald!
The problem here is that you are not creating a variable named language instead you create a variable named str.
Here is the solution:
// Enter your code below
var language: String = "swift"
language = "Objective-C"
Ronald Todman
1,487 PointsHi, Tromben, thanks for helping me figure this out, I tried what you recommended, but it did not work. Here is the question I am trying to solve, " 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."
Thanks
tromben98
13,273 PointsI ran the challenge with my code and it worked for me. Paste in my code in the editor and it should work. Otherwise there might be a problem with your browser.
Ronald Todman
1,487 PointsI posted it in Xcode, it worked with no problem, I will take a look at my browser and make sure I am up to date.
var "notetoself: String = "Write the code in your swift program as well as the browser"
notetoself = "Thanks for the help"
Cheers :)