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

Ricardo Gonzalez
Ricardo Gonzalez
2,286 Points

Can I know what it is that I am doing wrong.

I think this is the way to solve this challenge but I keep getting stuck can I have some hints.

strings.swift
let name = "Ricardo Gonzalez"
let greeting = "Hi there, \(name) , .,"
let finalGreeting = "\(greeting), How are you?"

2 Answers

Here you go:

let name = "Ricardo Gonzalez"
let greeting = "Hi there, \(name)."
let finalGreeting = greeting + " How are you?"
Ricardo Gonzalez
Ricardo Gonzalez
2,286 Points

Oh ok I see. I just had to read more carefully. I just notice that it was asking for the concatenated method and not the interpolation method. Thanks a lot for helping me find my mistake.

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Ricardo,

You're definitely doing it right! Your problem actually isn't code - it's grammar. Your greeting just has some extra punctuation, and then you also added an extra comma in finalGreeting. All you need to do is clean that up:

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

That said, the challenge does ask you to use the concatenation method, so Jcorum's answer is correct. Just thought I'd add some additional explanation to why you weren't getting a helpful error message.

Ricardo Gonzalez
Ricardo Gonzalez
2,286 Points

Oh ok I see. Thanks for helping me find my mistake.