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 trialmohamed hassan
2,079 Pointsstuck into creating some basic codes
i am trying to put that The product of 4 times 9 is 36 however it is not going through
// Enter your code below
let firstValue = 4
let secondValue = 9
let product = firstValue * secondValue
let value = "The product of"
let mutliplying = "times"
let bet = "is"
let output = "\(value) \(firstValue) \(mutiplying) \(secondValue) \(bet) \(product)
[MOD: formatted code block - srh]
1 Answer
Steve Hunter
57,712 PointsHi there,
I formatted your code block so it is clearer.
Your code has a few issues with it. Firstly, it is far too complicated - there's no need to create a value to interpolate every item in the output
string. You just need to interpolate the numeric values. However, your code will work with some corrections.
Firstly, terminate the string - you haven't closed the inverted commas. Secondly, spell multiplying
consistently in the two places you use it.
That's it - your code will work fine. But the challenge is expecting this:
let firstValue = 4
let secondValue = 9
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
I hope that helps,
Steve.
Dave Harker
Courses Plus Student 15,510 PointsDave Harker
Courses Plus Student 15,510 PointsPlease format that in such a way that it is human readable.
I mean I want to help here, but other than the first part of your sentence, the rest is jibberish. I find it highly unlikely that team treehouse phrased their instructions in such a way.
I'll follow the thread so if you update it, I might be able to offer some help.
Best of luck otherwise,
Dave.