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 trialEm Har
9,775 PointsVariable named language
im putting var str = "swift" but my error says make sure your variable is a named language. What do I do?
// Enter your code below
var str = "swift"
2 Answers
KRIS NIKOLAISEN
54,971 Pointsmake sure your variable is named language
var language = "Swift"
Caleb Kleveter
Treehouse Moderator 37,862 PointsYour variable looks like this:
var str = "swift"
A variable has 4 components:
- The variable keyword (
var
) - The name of the variable (in your case
str
) - The assignment operator (
=
) - The variable's value (in your case
"swift"
)
The error you are getting says you need to make sure you have a variable named language
, so you should change the second component I listed to fix that. Though your code technically works, the challenge expects a specific name for the variable.
As a side note, make sure the casing of the string you assign the variable to is correct. Swift
might be correct while swift
could cause the challenge to fail.
Em Har
9,775 PointsI appreciate it!