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!

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

I can’t seem to figure out what’s wrong with my code. help please

What is the main mistake in the declaration?

// Enter your code below
let name = " Blanche."
let greeting = " Hi there,"
let interpolatedGreeting = "\(greeting),\(name)

Quick glance: Syntax depends a bit on what language your writing in.

String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal. You can use string interpolation in both single-line and multiline string literals. Each item that you insert into the string literal is wrapped in a pair of parentheses, prefixed by a backslash (\):

let multiplier = 3
let message = "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)"
// message is "3 times 2.5 is 7.5"

1 Answer

Margarita Garmutė
Margarita Garmutė
2,136 Points


in the challenge they asking you create just two constants. You created three. So let greeting constant should contain "Hi there" and the name. So you did everything correct but need to change.