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

Garfield McCormick
Garfield McCormick
351 Points

I’m on an iPad. What’s wrong with what I typed?

I’m using an iPad. I thought I was following directions. My code won’t compile. I don’t really understand what the debugger is saying.

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

2 Answers

Alphonso Sensley II
Alphonso Sensley II
8,514 Points

Hello Garfield, You are on the right track. Remember that an interpolated string inserts the value of a variable. Right now you're telling the compiler to look for a "Hi There" variable. Instead you should write out the string"Hi there, and tell it to insert the value of the variable "name" You can write it this way:

let greeting = "Hi there,  \(name)"
Garfield McCormick
Garfield McCormick
351 Points

Got it! It works. Thanks Alphonse. I am loving this course.