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 2.0 Basics Swift Types String Manipulation

Could u please describe how this code should look? I dont get it.

I would like to know the write code for this practice question please.

strings.swift
// Enter your code below

let name = "Franko"

let greeting = "Hi there, Franko."

let interpolatedName = "\(name), \(greeting)
luke jones
luke jones
8,915 Points

Hi Francesso,

let name = "Franko"

let greeting = "Hi there, (name)."

Above is the correct code for the question.

You're simply combing the greeting "Hi there" with the constant "name" with interpolation. This then returns "Hi there, Franko"

If you wanted to return the same result using string concatenation, it would be written as:

let name = "Franko"

let greeting = "Hi there, " + name + "."

hope this helps :)

1 Answer

Keli'i Martin
Keli'i Martin
8,227 Points
// Enter your code below
let name = "Franko"
let greeting = "Hi there, \(name)."
let finalGreeting = greeting + " How are you?"

Take care to put in the proper spaces and punctuation.