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 trialSan Francisco
28,373 PointsChallenge 2 of 2 https://teamtreehouse.com/library/swift-20-basics/swift-types/recap-swift-types
What is the proper format for this to work?
Thanks
// Enter your code below
let firstValue = 69
let secondValue=70
let product = firstValue * secondValue
let output = "The product of (\firstValue) + 'times' + (\secondValue) 'is' + (\product)"
______
| derp |
------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
1 Answer
Steve Hunter
57,712 PointsI think the backslash comes before the bracket - \(varName)
. Also, you don't need the + signs as you are not concatenating the strings - everything is enclosed within the inverted commas, so the whole thing is a string, just with the variable values interpolated in there. Example below.
I hope that helps.
Steve.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsSan Francisco
28,373 PointsSan Francisco
28,373 PointsThank you Steve