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

matthew Rowe
matthew Rowe
487 Points

i am not sure what I am missing - how do i assign a variable to a string?

not sure how to add a variable to the string

strings.swift
// Enter your code below
let name = "snow"
let greeting = "hi,there"
let interpolatedgreeting = "\(greeting), \(name),"

1 Answer

You may have read that wrong. The error message you receive is "Bummer: Make sure you are assigning the correct string to the variable!".

You'll want to use the constant greeting and the code checker is usually very picky when it comes to text. For the interpolated string you can combine the two as follows:

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