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

what does this mean in english; You need to interpolate the value of the 'language' constant into the string you pass to

what does this mean in english; You need to interpolate the value of the 'language' constant into the string you pass to 'println'.

what is Interpolate?

println.swift
var modernProgrammingLanguage: String = "Swift"
println (modernProgrammingLanguage)

2 Answers

Christopher Augg
Christopher Augg
21,223 Points

Zifcak,

According to the webster's dictionary:

: to put (something) between other things or parts; especially : to put (words) into a piece of writing or a conversation

According to Swift documentation:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html

excerpt:

"String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal. Each item that you insert into the string literal is wrapped in a pair of parentheses, prefixed by a backslash:

       let multiplier = 3
       let message = "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)"
       // message is "3 times 2.5 is 7.5"

In the example above, the value of multiplier is inserted into a string literal as (multiplier). This placeholder is replaced with the actual value of multiplier when the string interpolation is evaluated to create an actual string."

Hope that helps.

Regards,

Chris

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Zifcak:

/*
To be able to use string interpolation you have to use the \() 
inside a string. This will print the values that are being held
by a constant or a variable. For example.
*/

let greeting = "Hello"
let name = "Zifack"
let value = 1

println("\(greeting), \(name) this is the number \(value) website to learn swift”)

//This will print β€œHello, Zifack this is the number 1 website to learn swift"