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 trialJuan Bosco
5,843 PointsHi, what is it im doing wrong? ;(
let firstValue = 2000 let secondValue = 3000
let product = "(firstValue) * (secondValue)"
let output = "The product of " + "(firstValue)" + " times " + "(secondValue)" + " is " + "(product)"
let firstValue = 2
let secondValue = 3
let product = "\(firstValue) * \(secondValue)"
let output = "The product of " + "\(firstValue)" + " times " + "\(secondValue)" + " is " + "\(product)"
2 Answers
kjvswift93
13,515 PointsFirst, the product constant needs to just store the product of the two Integers, and as such shouldn't store a string. Second, you seem to have used both string interpolation as well as concatenation in attempt to create the output constant that needs to store a string that will print "The product of 2 times 3 is 6". Instead what you have done is created a string that would output "The product of (firstValue) times (secondValue) is (product)".
let firstValue = 2
let secondValue = 3
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Nehemiah Reese
17,692 PointsNo need to put firstValue and secondValue in string interpolation when multiplying.
Juan Bosco
5,843 PointsDear Nehemiah,
Thank you for the fast reply man!
Juan Bosco
5,843 PointsJuan Bosco
5,843 PointsDear Kyle,
Fantastic response. Very impressed of the quick reply from both of you! Thanks!