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 trialkerim can çelik
Courses Plus Student 564 Pointscould you please help me
i dont know what i have to do
// Enter your code below
let firstValue: Int=3
let secondValue: Int=5
let product: Int = firstValue*secondValue
let
4 Answers
Zachary Kaufman
1,463 PointsString interpolation is "like this but adding () within the string to input a value"
so...
// Enter your code below
let firstValue: Int = 1
let secondValue: Int = 2
let product: Int = firstValue * secondValue
let output: String = "The product of \(firstValue) times \(secondValue) is \(product)"
would return "The product of 1 times 2 is 2
Zachary Kaufman
1,463 PointsYes, so basically in Swift and most other languages, if you see "" it means that anything within the "" is a string. No matter what is in the "" it will be registered as a string according to the language. The exception is if you put () inside the "". So for example
"The product of \(firstValue) times \(secondValue) is \(product)"
What the program is ACTUALLY seeing is "The product of 1 times 2 is 2" because those are the values inside of (). DOes that make sense?
Batuhan Dogan
2,587 PointsSo what it would be the answer, I been trying but its not working the senteces and also I tried to make like this let output = (firstValue) * (secondValue) = (product)" but it didn't work as well.
Zachary Kaufman
1,463 PointsCan you send me all your code?
Batuhan Dogan
2,587 PointsI actually did it, thank you sir
kerim can çelik
Courses Plus Student 564 Pointskerim can çelik
Courses Plus Student 564 Pointsi dint understand the last sentence could you explain it thank you