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

What am i doing wrong?

I declared my constants already and have identified my interpolated variable to print out the string.

strings.swift
// Enter your code below
let name = Arman
let greeting = Hi there,

let interpolatedGreeting = "\(greeting) \(name)";

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Arman,

Your first issue is in the following line:

let name = Arman

In Swift, strings need to be enclosed in double quotes, otherwise the Swift compiler will think you are referring to a variable or constant named Arman.

The next line has the same issue. After you fix that issue, you will note that this string is not consistent with what the question is asking for:

Set the value of greeting to an interpolated string that combines "Hi there, " with the string stored in the name constant.

Even if your greeting constant was a string, it wouldn't be an interpolated string. Your greeting constant should contain the string literal "Hi there, " combined with the contents of name. That combination should be achieved by the use of string interpolation.

You should not have any other constants declared (so you should not have a constant named interpolatedGreeting).

Hope that clears everything up for you.

Cheers

Alex