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!

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

iOS Swift Basics Swift Types Recap: Swift Types

Abdullah Tharwat
Abdullah Tharwat
Courses Plus Student 192 Points

I'm stuck here

I can't declare an interpolated string to be at the end " the product of 2 times 4 is 8 " firstValue = 2 secondValue = 4 product = 8

// Enter your code below

let firstValue : Int = 2
let secondValue : Int = 4

let product : firstValue * secondValue = 8
let firstly = "the product of"
let output = "\(firstly), \(firstValue) * (secondValue) \(product)"

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Abdullah,

There are a few small mistakes in your code.. let's fix them.

On the "product" constant, you are not declaring anything there. The syntax is incorrect.

/// Lets do something like this

let product: Int = firstValue * secondValue

Remember, that when you do a declaration, you do not need to explicitly show the type you are declaring, the system will infer it for you, unless its ambiguous and it must be declared.

/// Instead you can do something like this

let product = firstValue * secondValue

Now, your output should look exactly as the requirement asks you.. including spelling, otherwise the system will not accept the answer.

/// Output with string interpolation 
let output = "The product of \(firstValue) times \(secondValue) is \(product)"

I hope this helps you solve your problem.

Good luck

Abdullah Tharwat
Abdullah Tharwat
Courses Plus Student 192 Points

You’re great , I see where my mistake was , thank you for helping :)

For the challenge to pass the value of output should be

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

times not time