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

Brave Williams
Brave Williams
171 Points

Just like example but interpolated string does not work.

Put code in as show but does not accept. Preview does not work. Possible to skip this challenge if there is an error? New to this platform so confused why you can’t see a list of comments under a challenge like other platforms; really useful.

Thank you!

strings.swift
// Enter your code below
let name = "Brave"
let greeting = "Hi there"
let finalGreeting = "\(greeting), \(name)"

2 Answers

Wouter Willebrands
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Wouter Willebrands
iOS Development with Swift Techdegree Graduate 13,121 Points

Hi Brave,

If you a referring to the first part of the challenge you are actually creating an extra constant for the completed message. The compiler is a bit picky when it comes to answers.

Try:

let name = "Name"

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

If you are referring to the second part of the challenge I think you forgot to add the "How are you?" part as part of the concatenation for the finalGreeting constant.

I hope that allows you to continue.

Happy coding!

This did work but my code worked in Xcode β€” I Just made a post about it

Brave Williams
Brave Williams
171 Points

Wouter,

I really appreciate you taking a few moments to help me out. I was referring to the first part and your solution worked for the compiler.

I had interpolated both the greeting and the name; though it was similar to the video and it worked in Playgrounds it did not work in the compiler.

Thanks a ton!