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 Recap: Swift Types

yusuf Dibswazit
yusuf Dibswazit
1,522 Points

make sure the sting literal you are creating is assigned to a constant called output ! what am i doing wrong??

my code:

let firstValue  = 50
let secondValue = 100
let product = firstValue * secondValue

let interpolatedoutput = "\(The product of) \(50) \(times) \(100) \(is) \(5000)"

1 Answer

Jason Wayne
Jason Wayne
11,688 Points

Not sure what the full question is, but seeing from your code, you are not assigning the the string literal to a constant called output. Also, I am guessing your string interpolation is not correct.

// Your code:
let firstValue = 50
let secondValue = 100
let product = firstValue * secondValue

let interpolatedoutput = "(The product of )(50)(times)(100)(is)(5000)"

//Perhaps you should try:

let firstValue = 50
let secondValue = 100
let product = firstValue * secondValue

let output = "The product of \(firstValue) times \(secondValue) is \(product)"

You don't have to put everything in a bracket. You should only place those value that you want to interpolate as part of the string in the bracket. And before the bracket, you should put the backslash symbol.

Hope that helps!

Jhoan Arango
Jhoan Arango
14,575 Points

Hey Jason:

I did some fixing on your answer so that It can display the code. Your answer still the same.

yusuf Dibswazit
yusuf Dibswazit
1,522 Points

thanx man,, it worked !.

Jason Wayne
Jason Wayne
11,688 Points

Jhoan Arango - Thanks! If you don't mind me asking, how do you go about doing that?

yusuf Dibswazit - Cool !

Jhoan Arango
Jhoan Arango
14,575 Points

You can read the markdown cheatsheet, or you can edit your answer and see how I did it.

Good luck