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 2.0 Basics Swift Types String Manipulation

Declare a constant named finalGreeting, and concatenate the value of greeting with the string literal " How are you?".

Am I misunderstanding the instructions

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

let finalGreeting =  (greeting); "how are you?"

2 Answers

Jhoan Arango
Jhoan Arango
14,575 Points

Hello:

Concatenating two strings is simple, all you have to do is add a plus sign between two strings.

var name = "String" + "String"

Since your greeting variable has a String value, you can also concatenate that.

let finalGreeting = greeting + "How are you?"

Good luck

Thanks, I think I was confused because we had the previous code showing. And there was no logical way of combining the two