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 trialLucas Peters
Courses Plus Student 1,003 PointsWhat is not good in here?
I don't get it, what is not good in here?
// Enter your code below
let firstValue: Int = 100
let secondValue: Int = 50
let answer: Int = firstValue + secondValue
let product = "\(firstValue * secondValue)"
let output = "The product of 100 times 50 is \(product)"
1 Answer
Gabriel Mititelu
5,881 PointsHi Lucas,
Firstly, for this challenge I think your answer constant is redundant , as I don't recall the challenge to ask for it.
Secondly, looking over the string interpolation's definition might be of help. I've fetched it for you:
String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal.
Thirdly, in the output constant, you aren't asked to hard code the values , but to construct your constant making use of string interpolation and your constants.
Finally, if you've read all of the above and still feel a bit confused, I'll provide an example below. However, I do hope you've had another go at it yourself before simply copying.
let firstValue = 10
let secondValue = 6
let product = firstValue * secondValue
let output = ("The product of \(firstValue) times \(secondValue) is \(product)")