Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Abhash Malviya2,890 Points
Identify 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))"
Jason AndersTreehouse Moderator 145,624 Points
There are a few issues happening here:
let productline, you haven't declared any variable called
b. This line, you should be using the variables that you declared in Task one --
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
theneeds to be capitalized to
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)"