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

I don't understand what I'm doing wrong.

I don't understand what I'm doing wrong. My text works fine in the xcode playground, but when I copy it into the editor on the webpage it keeps giving me errors, is it just me messing up some where?

strings.swift
// Enter your code below
let name = "Zachary"
let greeting = "\("Hi there,") \(name)\(".")"
let finalGreeting = "\(greeting) \("How are you?")"

1 Answer

Moritz Lang
Moritz Lang
25,909 Points

Hi there :) I'm really wondering how your code could run in a playground. When using string interpolation you should go piece by piece. If you want to interpolate a variable you use \(), but if not you can simply write the String in quotes.

let name = "Zachary"
let greeting = "Hi there, \(name)."
let finalGreeting = "\(greeting) How are you?"