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 2.0 Basics Swift Types String Manipulation

String Interpolation

I don't know how to do this please help

strings.swift
// Enter your code below
Let interpolation name = Kevin  
Let greeting = "Hi There\(name)"
Let greeting = "Hi There, Kevin"

1 Answer

Hi Kevin!

You are pretty close there but I can spot the mistakes you are making. First of all, definitely keep an eye on your capitalisation as most programming languages are case-sensitive and anything being in the wrong case can completely break your program. Secondly, the challenge might be failing because when you are interpolating your string of 'Kevin' into the greeting you aren't giving it a space before-hand so it would print out like this "Hi thereKevin". Finally, make sure you watch out for your variable name. Variable names cannot contain spaces to "interpolation name" is not a valid variable.

So, if you use the following code everything should work absolutely fine for you!

let name = "Kevin"
let greeting = "Hi there, \(name)."

I hope that I managed to help you out!