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

It works on Xcode but not here?

Trying to complete the challenge here but it says "make sure you are assigning the correct string to the variable!" even though this works perfectly in Xcode

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Ferhat,

While the code may be correct in syntax and work in Xcode, it is not what the challenge is asking for. Challenges are very specific in what they ask for and what they expect.

Task one asks for only two constants, but you have three. It did not ask for one named interpolatedgreeting.

You have the first part of Task one correct -- the name constant. But the second part wants a greeting constant that is

an interpolated string that combines "Hi there, " with the string stored in the name constant.

So, you just need to fix up the code to the specifics of the instructions and you'll be good to go.

Keep Coding! :) :dizzy: