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 trialSua Kim
449 PointsIām not sure how to make the code evaluate my values that I assigned to my constants
How am I Supposed to make the code evaluate the values?
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 3
let product = 6
let output = "The product of 2 times 3 is 6, \(firstValue * secondValue = product)"
1 Answer
Jhoan Arango
14,575 PointsHello Sua:
You are doing good, sometimes it's difficult to grasp on the definitions and the "coding" talk, but you will get the hang of it as you go.
In this challenge we want to first create two constants and then we will multiply them.
let firstValue = 2
let secondValue = 6
let product = firstValue * secondValue // Multiplying both values
After we have done that, then we want to use string interpolation and assign it to another constant called "output".
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
// By doing it this way you are not hardcoding the string, so you may use different values
// and you will always get the same sentence but with different "values".
This will give you the desired result.
Good luck, hope this helps.
Also remember to select best answers to help others know which answer has helped you solved and understand your problems.