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 trialRob Sproat
493 PointsWait what.... "You were supposed to print 'Learning Swift' but instead you printed 'Learning Swift'
let language = "Swift" var str = Learning" var greeting = "(str) (language)" println (greeting)
And I got an error of: You were supposed to print 'Learning Swift' but instead you printed 'Learning Swift'
Wait what....
kaitlanlang
3,042 PointsHi Rob, the parser is very specific what it is hunting for, quite often to pedantic. Any way there some things with your code worth noting. Your variable str is missing its first set of quotes.
When concancating with your greeting variable it could read:
var greeting = str + language
( making sure with above you allow a white space at start of the contents of your actual language variable)
Or string interpolation:
var greeting = "\(str) \(language)"
in this example you don't have to have the White space built into variable it's simply allowed for by entering a space between strings.
I'd say it will parse if you use one of the above. Since this question was a long time ago I'm not sure if it wanted concancating or string interpolation. It will want one or the other which would explain why it's parsing without parsing if you get what I mean.
Good luck :)
1 Answer
kaitlanlang
3,042 PointsMeant to post this down here, so for repeat
Hi Rob, the parser is very specific what it is hunting for, quite often to pedantic. Any way there some things with your code worth noting. Your variable str is missing its first set of quotes.
When concancating with your greeting variable it could read:
var greeting = str + language
( making sure with above you allow a white space at start of the contents of your actual language variable)
Or string interpolation:
var greeting = "\(str) \(language)"
in this example you don't have to have the White space built into variable it's simply allowed for by entering a space between strings.
I'd say it will parse if you use one of the above. Since this question was a long time ago I'm not sure if it wanted concancating or string interpolation. It will want one or the other which would explain why it's parsing without parsing if you get what I mean.
Kirby Walls
6,508 PointsKirby Walls
6,508 PointsI don't know Swift, but this sounds like a type error... like it was expecting you to print "Learning Swift" as the result of your variables evaluating, but instead you told it to print a string whose content was the evaluation of the variables.
Like the difference between println("Learning Swift") and println(greeting)
...?