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

let name="Linda" let greeting="Hi there,\(name)" this out put is "Hi there,Linda" but in here show error code why

let name="Linda" let greeting="Hi there,(name)" //let final="(greeting),(name)" why is it wrong in here?

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

2 Answers

Hi there,

It is just complaining about the lack of spacing in the string. Add a space after the comma:

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

Steve.

For added readability, I added a space either side of each equals sign too. But I don't think that affects the challenge, but the code parser prefers it.

Michael Afanasiev
PLUS
Michael Afanasiev
Courses Plus Student 15,596 Points

Hi Lahiru,

Your syntax is correct, just try to add some spaces - for example, between the assignment operator and your assigned String. Actually, to pass this challenge you need to add one space between your "Hi there" and the interpolated string like so:

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

Hope this helps! ✊