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

What am I doing wrong?

I'm not able to get past this

strings.swift
// Enter your code below
let name = "Danielle"
let greeting = "Hi there"
let interpolatedgreeting = "\(greeting), \(name)"

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey there,

While your code is technically correct in syntax, it's not what the challenge is asking for.

Task one you have is correct with your name assigned to a constant named name

Task two only asks for one more constant named greeting, but you also have a third constant? The interpolated string the challenge is looking for needs to be assigned only to the greeting constant. So you need to delete the interpolatedGreeting and do everything for the second task with only one line of code assigned to the constant greeting.

Give it another go with that in mind, and remember challenges are very picky and extremely strict. So, you always need to pay very close attention to the instructions and never add more than what is asked.

Keep Coding! :)

:dizzy:

Thanks this was helpful

andren
andren
28,558 Points

The challenge asks you to set the greeting variable to an interpolated string containing "Hi there, NAME", it does not ask you to create a separate interpolatedgreeting variable where you do the interpolation.

The solution to the first task looks like this:

let name = "Danielle"
let greeting = "Hi there, \(name)"