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

I don't get this question

For this task, it asks me to Declare a constant named finalGreeting, and concatenate the value of greeting with the string literal " How are you?".

but, I never get it right. I checked a few times and even checked it in Xcode, but I just can't find the reason why I got it wrong. Please help me, thank you.

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

1 Answer

Make sure you read this challenge carefully. They want you to first interpolate and then concatenate with the required constant names. You don't need to create separate objects for the text.

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

Thank you so much, I have been stuck on this for days!