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

i am stuck

its not accepting constant let greeting="hi there,kerim"

strings.swift
// Enter your code below
let name = "kerim"
let greeting = "hi there,kerim"

1 Answer

You are suppose to be interpolating the string using 'name'. This is useful especially if the name may be different between users of an app for example. Lets say you have an app which includes user accounts, not everyone will have the same first name so hardcoding a name permanently in wouldn't work. Using a constant and assigning it the value of a users name would allow you to place their name into a message as below and then display it to the user via a alert for example. Also you need to capitalize the h.

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