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

jaden lind
jaden lind
300 Points

interpolating strings into the println function

I am doing a challenge where it asks me to interpolate a constant language string into the println function. I am a beginner so I am still getting a hang of the fundamentals. I have tried a variety of different things but am stuck now.

println.swift
let language: String = "Swift"

print("Learning / (language)")

1 Answer

Hi Jaden,

You're very close. First, the function is println, so that needs a little adjusting.

Then, to interpolate a string from a variable you first surround the variable name in brackets then precede that with a backslash. \(language)

Your finished result looks like:

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

Hope that helps!

Steve.