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

Daulet Bakhbergenov
Daulet Bakhbergenov
306 Points

What I am doing wrong?

Here is asking to combine. I don't understand please could anyone help

strings.swift
let name = "Daulet"
let greeting = "Hi there, "
let combination = greeting + name

let entropolatedCombination = "\(greeting) \(name)"

2 Answers

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

Hi Daulet,

The challenge is telling you to set the constant greeting to the value of "Hi there, " followed by (using interpolation) the value in name.

You've demonstrated in your last line that you know how to use string interpolation, you just need to make sure that the result ends up in the right constant.

You should end up with just two lines:

  • one declaring the constant name and assigning the value of your name to it (you already have this exactly right);
  • one declaring the constant greeting and combining (using interpolation) the string literal "Hi there, " and the contents of name.

Hope that helps

Cheers

Alex

harshil bhatt
PLUS
harshil bhatt
Courses Plus Student 2,722 Points

let name = "Daulet" let greeting = "Hi there, " let combination = "(greeting) +( name)"

let entropolatedCombination = combination

// This one is right