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

Adam Weston
Adam Weston
180 Points

Swift Task 2 Make sure the value you are assigning to greeting is an interpolated string

Need help getting past this area it is looking correct inside Xcode but don't know what it wants for this question

Thanks Adam Weston

strings.swift
// Enter your code below
let name = "Adam."
let Greeting = "\(name) Hi there," 
let finalGreeting = "How are you?"
let greeting =  Greeting + finalGreeting

2 Answers

There is a note in the challenge : Important: In each task of this code challenge, the code you write should be added to the code from the previous task. The message from the checker is probably for the first task even though you are on to the second.

Anyways the final expression will read "Hi there, Adam. How are you?". The greeting variable should be lowercase with the name at the end

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

Then for the second task just concatenate with the text provided:

let finalGreeting = greeting + "How are you?"

One issue right off the bat is that your "Greeting" constant declaration is uppercase. The final code should only contain three lines. Note that in the above answer, the output would be "Hi there, Adam.How are you?"

// Enter your code below

let name = "Adam"
let greeting = "Hi there, \(name)" 

let finalGreeting = greeting + ". How are you?"