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 Strings

Frank Solleveld
Frank Solleveld
1,996 Points

Getting some weird errors while declaring let etc.

So I tried following along and unfortunately I stumbled upon some errors. I cannot seem to find out why there are errors so I'm asking you guys C:

https://gyazo.com/c1f010430957c28b49ad4ae7f2c82312

4 Answers

Floris De Feyter
Floris De Feyter
17,174 Points

I don't think there is anything wrong with your code. You can try to clean your build folder and check if the error still occurs. You can clean your build folder with Command+Option+Shift+K.

Tal Zion
Tal Zion
6,234 Points

Try "(String(buildingNumber))"

Stephen Emery
Stephen Emery
14,384 Points

I wrote out your code and it worked fine for me. Something I've noticed is errors can show up while you are typing and then go away after you run the program again. If it keeps up, try updating your version of Xcode, because this clearly isn't working the way it should.

Hi Frank,

I have tried your code on a new page on my XCode playground:

let country = "Nederland"
let province = "Zuid Holland"
let city = "Leiden"
let street = "Dorpsstraat"
let buildingNumber = 15

let address = country + ", " + province + ", " + city
let interpolatedAddress = "\(country), \(province), \(city)"
let interpolatedStreetAddress = "\(street) \(buildingNumber)"

and the result was as expected:

"Nederland"
"Zuid Holland"
"Leiden"
"Dorpsstraat"
15

"Nederland, Zuid Holland, Leiden"
"Nederland, Zuid Holland, Leiden"
"Dorpsstraat 15"

as others mentioned there was no error so you might want to try restarting your Xcode IDE.