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

iOS Swift Basics Swift Types Type Safety and Type Inference

Michael Bau
Michael Bau
3,394 Points

In the code challenge I get the message "Use of unresolved identifier"

Hi,

This message refers to the 'product' constant.

I am unsure as to how to determine the 'product'.

Do I write:

'a' * 'b' or '120' * '33' (the numbers I have used) or 'firstValue' * 'secondValue'

Which is correct?

My 'output' constant looks like this:

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

Best regards

So we can see exactly what's going on...is there anyway you can show us your code?

3 Answers

Kyle Johnson
Kyle Johnson
33,528 Points

Hi Michael,

It looks like you almost have it correct but you are missing one thing. You forgot to put the \ in front of your constants in the string. You also don't need those commas if you want to be grammatically correct. Your code should look like this:

let output = "The product of \(firstValue) times \(secondValue) is \(product)."
Michael Bau
Michael Bau
3,394 Points

Hi Kyle,

Thanks for your answer. I tried to write the string as you suggested but still get the same error. Could there be something with the earlier constants?

My 'product' constant looks like this = let product = a * b, is this correct?

By the way, I have yet to understand how to insert screenshots in a comment. How is this done?

Best regards, Michael

Michael Bau
Michael Bau
3,394 Points

Hi again,

I just realized that my 'product' constant was wrong. I should have typed 'firstValue' * 'secondValue' instead of 'a' * 'b'. My bad.

So, that combined with your suggested 'output' constant, did the trick. Thanks!

Best regards, Michael