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 trial

iOS Swift Basics (retired) Types Printing Results

Amir Amiri
PLUS
Amir Amiri
Courses Plus Student 102 Points

Could you please explain the answer of this challenge

This is how I wrote this:

let language = "Swift" var Amir : String = "Learning" println(amir+language)

I don't know why it's not working !!!

println.swift
let language = "Swift"
var Amir : String = "Learning"
println(Amir+language)
Shubham Batra
Shubham Batra
1,960 Points

The problem is in the last line. It should be:

println(Amir + language)

There should be a space before and after the plus operator

Amir Amiri
Amir Amiri
Courses Plus Student 102 Points

Actually I did and this is the error again: You need to interpolate the value of the 'language' constant into the string you pass to 'println'.

1 Answer

Holger Liesegang
Holger Liesegang
50,595 Points

Welcome to Treehouse, Amir Amiri !

The error message said: "You need to interpolate the value of the 'language' constant into the string you pass to 'println'."

You can do that like this:

let language = "Swift"
println("Learning \(language)")

...also you might want to have a look at https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html at section String "Interpolation"