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 trialMohd Monish
208 Pointsnot geeting point where i did mistake
multiply two number
// Enter your code below
let firstValue: Int=23
let secondValue: Int=45
let product: Int=firstValue*secondValue
let output="\(firstValue)time \(secondValue)is \(product)"
1 Answer
jcorum
71,830 PointsKyle's right, you should put spaces between operands and operators. But you also need to be careful to follow the instructions exactly, as the editor is a program and looks for exactly what was asked for. In this case, the output String was supposed to contain the words "The product of ... times ... is ..." You left out "The product of" and you had "time" instead of "times".
let firstValue = 23
let secondValue = 45
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Also note that the "preferred" way of declaring properties is to let Swift infer the type when it can. That is:
let firstValue = 23
rather than
let firstValue: Int = 23
Kyle Lambert
1,969 PointsKyle Lambert
1,969 PointsAll you need to do is correct your syntax, your code is tedious to read. Just space it out a little better. I hope this helps