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

not sure how to do this

I don't understand what is asking

strings.swift
// Enter your code below
let name = "wilian"
let greeding = "greeding"


let interpolatedgreeding = "\(wilian), \(hi there)"

2 Answers

Brianna Lanz
Brianna Lanz
184 Points

Hello,

your code should look like this: let name = "sam" let greeting = "Hi there, \ (name)" let finalGreeting = greeting + "." + "How are you?"

Essentially the task is asking you to demonstrate the two essential concepts of string manipulation - interpolation and concatenation. The greeting constant uses your name (declared in the constant 'name') and "interpolates" it into a string so as to read "Hi there, Willian". The finalGreeting constant uses the greeting constant, which reads ("Hi there, Willian"), and links, or "concatenates", the phrase "How are you?", in order to make the final output read "Hi there, Willian. How are you?"

let name = "Willian"
let greeting = "Hi there, \(name)"
let finalGreeting = greeting + ". How are you?"