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

Donte nall
Donte nall
1,961 Points

I am having a difficult time with the println function

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

Use the language constant within the string you pass to your println statement. Practice using string interpolation.

let language = "Swift"

My answer: println("Learning / (language)")

But it is showing that it is the wrong answer. Am I supposed to make another variable for "Learning" than use string interpolation?

println.swift
let language = "Swift"

var scr = "Learning"

println("Learning / (language)")
Reed Carson
Reed Carson
8,306 Points

i would STRONGLY recommend you use the swift 2.0 track. swift 1 is outdated, println no longer exists, its just print now. On top of that, Swift 3.0 is coming out soon, and if you arent up to date with Swift 2 you will be even further behind. There is basically no reason to use swift 1

1 Answer

Taylor Amsler
Taylor Amsler
4,427 Points

Hi Donte, you're almost there. You do not need to make another variable for learning, but remember that you must use a BACKslash instead of a slash. You must also place the backslash directly in front of the interpolation.

let example =  "This is an example"

print( "\(example)")

These things are much easier to spot inside a playground, so I'd recommend practicing in one and then copy-pasting your answer into Treehouse. Good luck!