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

Ollie Drabble
Ollie Drabble
3,058 Points

im sure ive answered this right

Given the constant named language, write a println statement which will print the following string: "Learning Swift".

let language: String = "swift"

println("Learning/(language)")

println.swift
let language = "Swift"

just type: println("Learning " + language)

Anything you put in side the () needs to be an object or a string. You have two objects that you are trying to print to the line. The first object is going to be the string "Learning". The second object is the variable called language. You add the two together with the +

3 Answers

String interpolation is like this: var language = "Swift" println("Learning (language)")

you / when your should have \

The other way is call Concatenating. It will work in Xcode, just not in the exercise you were on. I should have noticed. Sorry.

James, I think in the above example you have inadvertently omitted the backslash character.

Ollie Drabble
Ollie Drabble
3,058 Points

i tried that too and it still says i need to interpolate the 'language' constant

AR Ehsan
AR Ehsan
7,912 Points

Me too! What code do you have to type!

Ollie Drabble
Ollie Drabble
3,058 Points

var language = "Swift" println("Learning\ (language)") and make sure you have the backslash the right way round