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 trialChristian Kroul
9,849 PointsSwift Recap
let firstValue: Int = 2 let secondValue: Int = 4 let product = firstValue * secondValue let output = " The product of (firstValue) times (secondValue) is (product)"
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = firstValue * secondValue
let output = " The product of \(firstValue) times \(secondValue) is \(product)"
3 Answers
Richard Lu
20,185 PointsHey Christian,
I see a space at the beginning of your output constant which is the root of the problem you're receiving. Omit that and you should be all set.
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = firstValue * secondValue
let output = /* there was a space at the beginning of this constant (inside the string literal) */ "The product of \(firstValue) times \(secondValue) is \(product)"
Good luck!
EDIT: 10.26.15
The challenge has been fixed, and you can now have your solution look like this with the types:
// Enter your code below
let firstValue: Int = 10
let secondValue: Int = 5
let product: Int = firstValue * secondValue
let output: String = "The product of \(firstValue) times \(secondValue) is \(product)"
Christian Kroul
9,849 PointsOh wow thank you, it was because of that space.
Raymond Carter, Jr.
iOS Development Techdegree Student 488 PointsCan somebody please explain the last part to me.
let output: String = "The product of (firstValue) times (secondValue) is (product)"
why do we put "the product of and times" in the string I don't remember them going over this in the video please help I'm lost
Christian Kroul
9,849 PointsChristian Kroul
9,849 PointsWell, that space really did make a difference Thanks Richard