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 2.0 Basics Swift Types String Manipulation

Kjersti Barstad Strand
Kjersti Barstad Strand
3,142 Points

What is wrong? xcode says itΒ΄s correct.

let name = "Kjersti" let greeting = "Hi there" let interpolatedGreeting = "(greeting), (name)."

strings.swift
// Enter your code below

2 Answers

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

Hi there! The code used must conform to the specifications of the challenge. For step one the challenge explicitly asks for an interpolated string to be assigned into the constant greeting. The challenge also does not ask for anything to be printed. You've implemented a new constant which they haven't asked for in interpolatedGreeting. Here is your modified code for step 1:

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

Hope this helps! :sparkles:

Sarthak Kedia
Sarthak Kedia
5,347 Points

You just need to add backslashes ( \ ) in your code:

let name = "Kjersti"
let greeting = "Hi there"
let interpolatedGreeting = "\(greeting), \(name)"
print(interpolatedGreeting)

This will print : "Hi there Kjersti"

Hope that helps. :-)