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 trialyusuf Dibswazit
1,522 Pointsmake 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
11,688 PointsNot 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
14,575 PointsJhoan Arango
14,575 PointsHey Jason:
I did some fixing on your answer so that It can display the code. Your answer still the same.
yusuf Dibswazit
1,522 Pointsyusuf Dibswazit
1,522 Pointsthanx man,, it worked !.
Jason Wayne
11,688 PointsJason Wayne
11,688 PointsJhoan Arango - Thanks! If you don't mind me asking, how do you go about doing that?
yusuf Dibswazit - Cool !
Jhoan Arango
14,575 PointsJhoan Arango
14,575 PointsYou can read the markdown cheatsheet, or you can edit your answer and see how I did it.
Good luck