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

Nader Habib
Nader Habib
1,106 Points

I tried to solve this question but I really need help

let name= "Nader" let greeting = "Hi there" let finalValue = "(greeting), (name) "

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

Concatenate the last part:

let name = "Jeff"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting)" + "How are you?"

The error comes that we think that challenge is asking to concatenate the greetings and the final greetings, which they are not. Also, in the playground will be more flexible to do it, bacause we can assign the names we ant to, but in the website we should name the names literally because will find an error.

So, first, change current name "finalValue" to finalGreeting.

Second, just string together the finalGreeting with the concatenated value of greeting.

finalGreeting = greeting + ". How are you?"