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

Chris Robinson
Chris Robinson
1,266 Points

Concatenation question 2: My Answer looks correct, but is not acceptable.

I have the following. It looks fine, works in Xcode, but I cannot get an acceptable response from the test. Please help.

let name = "Pasan" let greeting = "Hi there, (name)" let finalGreeting = "(greeting). How are you?"

strings.swift
// Enter your code below
let name = "Pasan"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting). How are you?"
Chris Robinson
Chris Robinson
1,266 Points

I have also tried moving the period. I even changed my name to Pasan. :)

2 Answers

Steven Deutsch
Steven Deutsch
21,046 Points

Hey Chris Robinson,

I don't have a subscription at the moment so I'm unable to view this challenge, however, I believe this task wants you to use String Concatenation and not String Interpolation.

let value = "This is the value we will extract"
let interpolationExample = "\(value) from the variable into a String."

let concatenationExample = "Here we combine two string literals" + " using concatenation."

You really have to pay attention to every line of code, every word, and every character when programming. Which is why I like the specificness of this task :D

What you did is perfectly valid Swift code! You just didn't solve it how Treehouse was asking you to.

Good Luck!

Jeff McDivitt
Jeff McDivitt
23,970 Points
let name = "Jeff"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting). + How are you?"