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

whats wrong with my code

whats wrong with my code

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

2 Answers

There really isn't anything "wrong" with your code to be honest. It works in Xcode. Its just not exactly what they are looking for in the challenge. The first part asks for interpolation and the second asks for concatenation. Your answer uses interpolation for both.

This is more like what they are looking for...

let name = "Ronald"

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

let finalGreeting = greeting + "How are you?"

Good work other than that! Keep on coding!

Trevor Duersch
Trevor Duersch
9,964 Points

Nothing is wrong with your code. It compiles just fine for me in my playground. Is there something you expect it to do? If you want it to show up in the debug area then you can do this:

print("\(finalGreeting)")