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

Jose Guzman
Jose Guzman
1,336 Points

I do not know what is wrong? It says i am not using interpolation.

I am sure this is simple, I am not sure what is wrong with my code.

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

1 Answer

Tobias Helmrich
Tobias Helmrich
31,603 Points

Hey there,

for the second task you have to use String concatenation instead of interpolation. I also recommend writing the period in the greeting constant and you don't have to create another constant just for the greeting and "How are you?" but your code would also be fine if you want to keep those constants.

Without the extra constants and with concatenation instead of interpolation for the finalGreeting constant it would look like this:

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

I hope that helps, good luck! :)

Jose Guzman
Jose Guzman
1,336 Points

thank you for the help, it worked great!