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!
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 trial
Christopher Tavarez299 Points
Not sure why My greeting Variable is not working
so far I have gotten it to work on xcode but not on the challenge task
As of Swift 2, the println function is no longer available and the print function should be used instead. That said, the online code editor for the challenges is still expecting the use of println. If you are using the latest version of Xcode, you will have to use the print function in the playground (use of println will give an error). For the online challenges you will have to use println until Treehouse makes the necessary updates.
As for string interpolation: It basically allows you to substitute the current value of a constant or variable within string.
var firstName = "John" var greeting = "Hello \(firstName)" print(greeting)
The above code would output "Hello John".
Without string interpolation, you would have to do the following:
var firstName = "John" var greeting = "Hello " + "firstName" print(greeting)
You would still get the same result, but string interpolation makes strings easier to format and your code easier to read.
Hope this helps.