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 trial
Cesar Gonzalez
614 PointsSOS NEED HELP HERE!! (SWIFT) This swift question is driving me crazy , saysThe string literal being assigned to output
let firstValue = 1 let secondValue = 2 let product = 2 let output = "(The) (product) (of) (firstValue)(times, secondValue) (,,is) (secondValue)"
2 Answers
Nathan Tallack
22,164 PointsYou did not link to the challenge so I cannot be sure what the challenge problem you are facing is. But considering your code.
let firstValue = 1
let secondValue = 2
let product = 2
let output = "(The) (product) (of) (firstValue)(times, secondValue) (,,is) (secondValue)"
I'd say that you are trying to complete a challenge where you are using string interpolation. If that was the case you would want to do something like this when declaring your output constant.
let firstValue = 1
let secondValue = 2
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Take care that you are formatting the output string to include the punctuation your challenge is asking for. Note that inside the string (between the "" quotes) we are typing regular words normally and we are using () to surround our values that we want to insert. The above code would have output look like this.
The product of 1 times 2 is 2
Hope this helps. :)
Cesar Gonzalez
614 PointsThanks man !!! Have a nice Christmas