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

Lewis Mansbridge
Lewis Mansbridge
1,119 Points

 Hi there, can anyone help me please, says the code is wrong, also it keeps crashing as in when i click work it freezes!

Hi there, can anyone help me please, says the code is wrong, also it keeps crashing as in when i click work it freezes and just says "working..." Thank you!!

strings.swift
// Enter your code below
let name = "Lewis"
let greeting = "Hi there, " + name + "."

3 Answers

luke jones
luke jones
8,915 Points

What you're doing here is concatenation. What it's asking for is interpolation. Here's the answer:

let name = "Lewis"
let greeting = "Hi there, \(name)."

The answer you given and the answer I have given produce the same results. The only difference is the method in which its done.

Moderator edited: Added Markdown to code to show syntax highlighting and moved from Comment section to Answer.