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 trialerickgonzalez
499 PointsIn line 9 around the 8-minute mark, Amit wrote "var greeting = "\(str) \(modernProgrammingLanguage)" (str) refers to ?
I thought at first it referred to line 5 where it reads var str : String = "Hello", but I noticed that on the Console Output it doesn't say 'hello' at all.
Thank you. :)
5 Answers
Frank Shi
1,859 PointsIt is referring to the value which has been assigned to var str.
erickgonzalez
499 PointsThat's what I would have thought, Frank, but maybe I'm missing something.
The only line in which I saw var could have been assigned something was in the line where it said: var str : String = "Hello "
However the word "Hello" was not shown on the Console Output even after having referenced it.
He wrote:
"var greeting = "(str) (modernProgrammingLanguage)", and on the right it only read: To build an iPhone app we need to learn Objective-C."
(Note: it reads objective-C rather than Swift because he was showing us how to change things around as we liked.)
kirkbyo
15,791 PointsThe reason why "Hello" is not being printed to the console is because he is not calling the variable str to be printed. When he created the greeting variable he was just creating a variable that contained a string and that could be printed later on. If you wanted to print out greeting, you could do something like this
println(greeting)
Hope this helped,
Ozzie
erickgonzalez
499 PointsOkay. Thanks, Ozzie and Frank. I'll be sure to go over this section again. :)
Dustin Keith
Courses Plus Student 1,403 PointsDon't forget that those final lines of code in the example are on two lines because he shrunk the pane!