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

Matej Sindelar
Matej Sindelar
5,286 Points

Can't pass Swift 2.0 Basics Challange Task 1 of 2

Can anyone help me pass? Where am I doing misstake?

I wrote: // Enter your code below

let name = "Matej."

let greeting = "Hi there, "

let interpolatedGreeting = "(greeting) (name)"

and it keeps saying I did some kind of a misstake.

thanks for helping.

strings.swift
// Enter your code below 
let name = "Matej." 

let greeting = "Hi there, "

let interpolatedGreeting = "\(greeting) \(name)"

2 Answers

This is correct code:

let name = "Antonija"
let greeting = "Hi there, \(name)."

There is nothing wrong with your code but task says there should be only 2 constants, name and greeting.

I tried this exact code let name = "Greg" let greeting = "Hi there, (name)." This comment is not showing the back slash before name but it's in my code. and it keeps saying "Your code could not be compiled. Please click on "Preview" to view the compiler errors."

Check Markdown cheatsheet, posting your own code is easy. After you check that, post your exact code here.

Also make sure you use \ , not /

Thanks for replying back so quick. It did end up passing. I think there's an problem with the interface of the code editor that makes it a bit buggy some times.

Great!

You're welcome. Just a tip. Carefully read challenges, do only what is specified or your code won't pass. Sometimes your code is actually okay but challenges accept only what they predefined I guess.