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

I don't understand what i did wrong?

idk what i did wrong

strings.swift
// Enter your code below
let name = "Jacob"

let greeting = "Hi there"

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Jacob,

While technically your code is correct in syntax, it does not follow the instructions for the task.

The instructions do not ask for a constant named interpolatedGreeting to be created, so that needs to be deleted.

The challenge explicitly asks for only the name and greeting constants, and the greeting should hold the string "Hi there, " (note the comma and space as well) with the name variable interpolated in that string.
So, there should only be two lines of code, like so:

let name = "Jacob"

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

So, while your code was correct :thumbsup: and will run in Xcode, you have to really pay attention to what the challenges are asking for. Any deviation, spelling errors, missing punctuation, etc. will usually end with a Bummer.

Keep Coding! :) :dizzy: