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 trialAbhash Malviya
2,890 PointsIdentify where i am wrong
Please can anyone identify where I am wrong
// Enter your code below
let firstValue = 4
let secondValue = 6
let product = a * b
let output ="\("the product of") \(firstValue) \("times") \(secondValue) \("is") \(product))"
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Abhash,
There are a few issues happening here:
For the
let product
line, you haven't declared any variable calleda
orb
. This line, you should be using the variables that you declared in Task one --firstValue
andsecondValue
.There needs to be a space between the = sign and the opening quotes for the interpolated string.
The interpolated string is not formatted correctly. I do highly recommend that you re-watch the String Interpolation video to review the proper formatting. There should be only one opening quotation mark and one closing quotation mark (You have 8). Only the variables are put inside the interpolation syntax
\()
. The actual hard coded strings are just as normal strings.The instructions are always very specific and very picky. So the first word in the string
the
needs to be capitalized toThe
.
I've provided the corrected code, but I very much recommend that you review this course before moving on, as variables and sting interpolation and string concatenation is very important in the future videos. Just make sure you have a strong understanding of "Types" before moving on to "Operators".
let firstValue = 4
let secondValue = 6
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Keep Coding!
Abhash Malviya
2,890 PointsAbhash Malviya
2,890 PointsHi Jason,
Thank You very much I totally understood where I went wrong. Thanks for the input
Thanks