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

Michele Livingston
seal-mask
.a{fill-rule:evenodd;}techdegree
Michele Livingston
iOS Development Techdegree Student 808 Points

The code I am entering works on the Xcode but does not work here. What could I be doing wrong?

Please see my code attached.

strings.swift
// Enter your code below
let name = "Michele"
let greeting = "Hi there"

let interpolatedSaying = "\(greeting), \(name)"

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

:sparkles: Your code does not meet the specifications of the challenge.

Hi there! You will find that many times in challenges, just having your code working and functional does not mean it will pass the challenge. Challenges are very strict and testing for specific things. Here's a quote from the challenge:

Set the value of greeting to an interpolated string that combines "Hi there, " with the string stored in the name constant.

Now take a look at your greeting constant. It is set to the value of "Hi there" and nothing else. The comma and interpolated value of name should also be part of this constant.

I feel like you should be able to get it with these hints, but let me know if you're still stuck! :sparkles:

:bulb: As a side note, it's always a good idea to avoid doing anything not explicitly asked for by the challenge. Even if functional, this can cause the challenge to fail. A third constant was never asked for.