Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,862 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