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 trialsultan saleh
Courses Plus Student 46 PointsCreate a constant named language and assign it a string "Swift"
how do i solve the question
var str = "Swift"
2 Answers
Meek D
3,457 PointsYou are on the right track you need to use let to declare a constant variable...
let language = "Swift"
Bao Pham
Courses Plus Student 240 PointsI just passed the first session as of now. I didn't understand it at first when I attempted to write the string because of simply the site does not behave exactly like the program "Xcode". I am not giving you the answer here, but when you are supposed to declare the string in reference to "Implicit types" the site does not automatically capitalize the declaration as the system running Xcode does. Had me scratching my head quite a bit haha.
Hint:
Basically when writing a string you learned at first to write "var" indicating the word (Or terms, abbreviations,etc.) after is the variable. Now, modifying the string line into a "Constant" would be using "let" instead.
Riley Spencer
1,753 PointsRiley Spencer
1,753 PointsYou've made two mistakes here
First, you have created a variable (using var), instead of an constant. To create a constant, replace the var with let.
Second, you have called it str. You should be calling it language.