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

String Interprolation does not work

In this challenge I was asked to concatenate name and greeting,

Here is my code:

let name = "Graham" let greeting = "Hi there"

let interpolatedName = "(name), (greeting)"

This code works in Xcode but not here

Thanks

strings.swift
// Enter your code below
let name = "Graham"
let greeting = "Hi there, "

let interpolatedName = "\(name), \(greeting)"

2 Answers

Hi Elizabeth,

That part of the challenge wants you to use concatenation, +, not interpolation. :smile:

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

Steve.

Ryan Sands
Ryan Sands
4,543 Points

concatenation is needed here:

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

I hope this helps... keep coding on!!

-Ryan