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 trialMike Tsirogiannis
211 PointsSet the value of Greeting to an Interpolated String
Here's what I wrote bu t it does not work: let name = "Mike" let greeting = "Hi there," let interpolatedGreeting = "(greeting) (name)"
// Enter your code below
let name = "Mike"
let greeting = "Hi there,"
let interpolatedGreeting = "\(greeting) \(name)"
Matt Skelton
4,548 PointsHi Mike,
Matti is spot on, the exercise has to be done in a very particular way. Just wanted to point out a slight typo in the final line of Matti's reply however that would stop the code from passing successfully.
let name = "Mike"
let greeting = "Hi there, \(name)"
That should do it, good luck!
Ingo Ngoyama
4,882 Points//You are hardcoding the variables. you need to allow for a soft code input with a function.
func sayHello(personName: String) -> String {
let greeting = "Hello " + personName + "!"
return greeting
}
//then you can test as below;
//1) make an instance using any name you want.
let greet = sayHello(personName: "Neneng")
//now you can call it greet
// and you can print it. print(greet)
Matti Helenius
421 PointsMatti Helenius
421 PointsHi Mike,
Try to make it on the greeting . I think it was really spefic how you make it, so you can pass the exercise.
Best regards M