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!