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 trialklaus schmitt
1,238 PointsNo clue how to approach a bug... :(
My code is as follows
let firstValue: Int = 2 let secondValue: Int = 4
let product: Int = firstValue * secondValue
let output: String = "The product of (firstValue) times (secondValue) is (product)."
I have no idea what goes wrong, so that I don't know where or what to fix... :(
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product: Int = firstValue * secondValue
let output: String = "The product of \(firstValue) times \(secondValue) is \(product)."
2 Answers
Richard Lu
20,185 PointsHi Klaus,
I gave this answer to another student that had the same question. The code you have is definitely correct, but I think what the instructor wants to emphasize is type inferencing (allowing the compiler to figure out the types). Here's what he wants:
// Enter your code below
let firstValue = 5
let secondValue = 7
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Happy coding!
Pasan Premaratne
Treehouse TeacherKlaus,
That answer should definitely work! I found the bug in our challenge and fixed it.
klaus schmitt
1,238 Pointsperfect. thx!
klaus schmitt
1,238 Pointsklaus schmitt
1,238 Pointshi Richard, that seemed to be the problem. thank you very much.