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 trialJohnny Torres
1,338 PointsAm I close? var str = "language" str = "swift"
var str = "language"
str = "swift"
// Enter your code below
var str = "language"
3 Answers
Zachary Betz
10,413 PointsJohnny, you're close. You would write it like:
var language = "Swift"
Let's break this down a bit, though.
var
is the keyword used when you are declaring a variable.
language
is the name of the variable.
Swift
is the value that you are assigning to the variable. In this case, Swift
is a string, and you know this because it is surrounded in double quotes, i.e. "Swift"
koko kokos
Courses Plus Student 777 PointsVariables are values that CAN change so when you first set language value to "Swift", you can change it later on to something else, in this case "Objective-C". Your code should look like this:
var language = "Swift" language = "Objective-C"
I hope that I helped you! ;)
Johnny Torres
1,338 PointsThanks!
Zachary Betz
10,413 PointsSure thing! Feel free to mark the answer as "best" if you're good to go.