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 trialPatrick Ritchie
3,211 PointsI am having a very difficult time trying to figure out what the question is asking. Nothing I do works for answers.
I have had trouble with this whole section. I cannot get the constants to go together with the way the question wants me to put them together. I'm not sure what I am doing wrong because I am typing the code just as the video shows me.
// Enter your code below
let firstValue = 2
let secondValue = 8
let product = "firstValue" * "secondValue"
"\(fisrtValue) times \(seondValue)"
product
Patrick Ritchie
3,211 PointsBen,
I couldn't get the first interpolation section either.. I thought maybe at first some kind of glitch, but I think I am just not doing something right. Would be awesome if they had an "Example" tab, just to compare your answer with something that is right. But, thank you for pointing out my typo! haha I need to pay closer attention to that!
Benarge Igwe
1,589 PointsPatrick,
Did it end up working? or are you still stuck on this challenge? Yeah I know it wasn't much help but we are just trying to progress at this app stuff. I hope you can get a reply soon regarding your question. I know how boring the waiting game is. sits at computer, waiting -_- lol
-Ben
Patrick Ritchie
3,211 PointsBen,
Watching the video over again. :( Always three steps forward and two steps back haha
Might have to take a break and come back, I HATE the waiting game! lol
2 Answers
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou assigned a number to product, not the result of multiplication. it's product = x * y, not product = (a number). your output string looks ok as long as you have the backslashes before the variables. they don't show up here if you don't escape them with a backslash so maybe you put them, i can't tell, for example here is one but i'm actually typing two \ . edit - your output string needs to say exactly word for word what they are asking for.
Patrick Ritchie
3,211 PointsFinally! Thank you James! just had to add "the product of" into the interpolated string to get that right and now I understand product = x*y
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyour string interp looks ok, just spell everything right, but product is not a string, it is the product of two integers, so it's just product = x * y. then make the string it asks you to with string interp, as in "\(myVar) is the best var, \(yourVar) is not..."
Patrick Ritchie
3,211 Pointslet firstValue = 2 let secondValue = 4
let product = 8
let output = "(firstValue) times (secondValue) is (product)"
I've tried this 10 different ways, I just don't know what the question is looking for exactly.
Here is what it is asking "Step 1: Declare a constant named product and assign the result of multiplying firstValue and secondValue together. (To multiply two values, a and b, we write a * b).
Step 2: Using string interpolation, create a string literal that describes the operation we just performed. For example, given the following values for firstValue, secondValue and product respectively: 2, 4, 8. The string should read: "The product of 2 times 4 is 8". Assign this string to a constant named output."
Benarge Igwe
1,589 PointsBenarge Igwe
1,589 PointsI'm in the same section but on the interpolation section (earlier part that you), and I'm also stuck with a similar problem. You're a bit further ahead than me it seems. But i think the spelling of (fisrtValue) is what's throwing off your code. It won't connect to the "let" function if the spelling is wrong. Try to adjust that in the last section and see what happens. Oh and spelling of "seondValue" is also gonna need to be fixed.
-Ben