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 trialEthan Cheong
5,058 Pointsjoning strings can't I do this let address = country + " " + state + " " + city?
can't I do this let address = country + " " + state + " " + city?
Miguel Angel Flores Izquierdo
2,275 Pointsif your constant address has not been previously declared in your code you can do that perfectly, all you need to check that country, city and state are previously declared: let state = "im in a state" let city = "im in a city" let address = state + " " + city
1 Answer
Moritz Lang
25,909 PointsYou could do this. However there is a cleaner way used throughout the Swift community:
let address = "\(country) \(state) \(city)"
This is called String interpolation, if you want to google it. :)
Bruce Röttgers
18,211 PointsBruce Röttgers
18,211 PointsYou can, or what is the question?.