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

Rayhan Miah
Rayhan Miah
2,369 Points

Whats wrong with this code

let name = "Rayhan" let greeting = "Hi there," let interpolatedGreeting = "(greeting) (name)"

whats wrong with it

strings.swift
// Enter your code below
let name = "Rayhan"
let greeting = "Hi there,"
let interpolatedGreeting = "\(greeting) \(name)"
Ben Masel
Ben Masel
2,004 Points

If it still doesn't work i know why, if that happens just comment on this page i and i will help!

2 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Rayhan,

You're coding correctly, but you should re-read the instructions :smiley:.

The first task asks you to

Set the value of greeting to an interpolated string that combines "Hi there, " with the string stored in the name constant.

So in your case, you need to interpolate your name right in the greeting string so that greeting stores "Hi there, Rayhan."

Given the code you've written, I'm sure you know how to do this!

Cheers :beers:

-Greg

Rayhan Miah
Rayhan Miah
2,369 Points

WOW thank you it worked

Ben Masel
Ben Masel
2,004 Points

Hi there Rayhan! All you forgot to do was concatenate interpolatedGreeting so interpolatedGreeting should really look like this:

let interpolatedGreeting = "(greeting)." + "How are you?"

hope this helps!