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

Nigel Matheson
PLUS
Nigel Matheson
Courses Plus Student 1,166 Points

interpolation not making sense

my interpolation is not right keeps coming up error

strings.swift
// Enter your code below

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

2 Answers

Alexandre Attar
Alexandre Attar
10,354 Points

The confusion here is the value in between your brackets in your Strings interpolation. For this, you actually have to simply enter you constant instead of it's assigned value.

// Enter your code below

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

Since, we are trying to retrieve the information from your constant. In this example, your constants are just place holders for the value stored in them.

This method is great to format your strings more efficiently.

Hope it helps!