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.

Bill Bruno
2,058 PointsHelp with your code challenge
For this code challenge, this is what I put. Works with Xcode but the code challenge says I am wrong. Please help me see what I am doing wrong and why does it work with Xcode?
let firstValue: Int = 20 let secondValue: Int = 24
let product = firstValue * secondValue let output = "("The product of ") (firstValue) ("times") (secondValue) ("is") (product)"
// Enter your code below
let firstValue: Int = 20
let secondValue: Int = 24
let product = firstValue * secondValue
let output = "\("The product of ") \(firstValue) \("times") \(secondValue) \("is") \(product)"
4 Answers

Zachary Kaufman
1,463 PointsDon't have ("") around your words. I think that will get it to pass. Hope this helps!

Zachary Kaufman
1,463 PointsHad that been a real life problem you would have passed because you were correct in your syntax. The only reason it didn't pass in the grader is because he was teaching how to input variable values into strings so the grader was searching for (variableName) inside of a set of " instead it got your solution of ("") and (variableName) so it counted it wrong. Good job and good luck with your classes!

zaid alqattan
2,206 Pointslet firstValue: Int = 20 let secondValue: Int = 24
let product = firstValue * secondValue
let output = "The product of (firstValue) times (secondValue) is (product)"

Grant Thomas
13,705 PointsIt looks like you're using the interpolation syntax wrong. You only want to interpolate your two constants. Not the entire string (Or strings in between) Try this:
let firstValue: Int = 20
let secondValue: Int = 24
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Bill Bruno
2,058 PointsBill Bruno
2,058 PointsThank you. I will try that. I would have thought Xcode would have took an error on that as well. All new learning experience. Thanks again.