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

Issue with String Concatenation 2 of 2

I've tried two methods that compiled without issue in Playgrounds.

First:

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

Second:

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

Neither method worked for the code challenge.

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

Nevermind. I needed to read the instructions more carefully. I was using string interpolation and not concatenation.

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Joe,

Your problem is that you are still using string interpolation in finalGreeting but the challenge is asking for string concatenation.

Cheers

Alex