## 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###### veasna mam

996 Points# let firstValue = 1234 let secondValue = 1234 let product = firstValue + secondValue let output = " The product of

Challenge Task 2 of 2

Given these two values we just declared, we want to compute the product and print out the product in a formatted string.

Step 1: Declare a constant named product and assign the result of multiplying firstValue and secondValue together. (To multiply two values, a and b, we write a * b).

Step 2: Using string interpolation, create a string literal that describes the operation we just performed. For example, given the following values for firstValue, secondValue and product respectively: 2, 4, 8. The string should read: "The product of 2 times 4 is 8". Assign this string to a constant named output.

// Enter your code below

let firstValue = 1 let secondValue = 3

let product = result a * b let a = 2 let b = 4

Bummer make sure the string literal you creating is assigned to a constante called output? Why?

MY CODE:

let firstValue = 1234 let secondValue = 1234 let product = firstValue + secondValue let output = " The product of (firstValue), times(secondValue),is (product)."

```
// Enter your code below
let firstValue = 1234
let secondValue = 1234
let product = firstValue + secondValue
let output = " The product of \(firstValue), times\(secondValue),is \(product)."
```

## 9 Answers

###### Steve Hunter

57,712 PointsNearly, yes - remove the commas - take out these , , so the string looks like:

```
let output = "The product of \(firstValue) times \(secondValue) is \(product)." // CORRECT
let output = "The product of \(firstValue), times \(secondValue),is \(product)." // incorrect - remove , ,
```

###### Steve Hunter

57,712 PointsHI there,

Have a look at my code in my last answer, a product is the result of multiplying two numbers together so use `*`

rather than `+`

. Like this:

```
let product = firstValue * secondValue
```

Not:

```
let product = firstValue + secondValue // incorrect; added together
```

Make sense?

Steve.

###### Steve Hunter

57,712 PointsYes, that is correct. You have included commas in your output string which are not needed.

The sting should look like this:

```
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
```

Not this, which you have:

```
let output = " The product of \(firstValue), times\(secondValue),is \(product)."
^ ^ ^ ^
```

No other characters are required so make sure you remove the commas and make sure your spacing is identical too. I have added a mark below each point that needs correcting either by amending the spaces or removing commas.

Steve.

###### Steve Hunter

57,712 PointsHi there,

You have added the two integers together; you want to multiply them? You want to take the commas out of the string too - the output isn't expecting to see them.

```
let firstValue = 2
let secondValue = 4
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
```

Steve.

###### veasna mam

996 PointsI dont get it can you show me an example?

how do I integers together?

###### veasna mam

996 PointsThank you for your help it stll has an error,

this what the error say

The format of your output string doesn't match the requirements listed. Double check the example given in the directions!

###### veasna mam

996 Points```
let firstValue = 1234
let secondValue = 1234
let product = firstValue * secondValue
let output = "The product of \(firstValue), times \(secondValue),is \(product)."
```

###### veasna mam

996 PointsAn error

this is my code.

```
let firstValue = 1234
let secondValue = 1234
let product = firstValue * secondValue
let output = "The product of \(firstValue), times \(secondValue),is \(product)."
```

the error said: The format of your output string doesn't match the requirements listed. Double check the example given in the directions!

###### veasna mam

996 PointsThank you a lot it works!!!

## veasna mam

996 Points## veasna mam

996 PointsAn error keep poping up can someone help me did I miss anything?