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 Recap: Swift Types

What's the solution? how do I print what should've?

help please

types.swift
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4

let product: Int = firstValue * secondValue

let stri:   String = "The product of \(firstValue) times \(secondValue) is \(product)"

1 Answer

andren
andren
28,558 Points

Your code is fine. The issue is that you have named the last constant stri, the task specifies that it has to be named output. If you rename it like this:

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

Then you will be able to complete the challenge.

it's still not working. it's saying: Bummer! Your code could not be compiled. Please click on "Preview" to view the compiler errors.

and the errors are :swift_lint.swift:8:12: error: consecutive statements on a line must be separated by ';' let product Int = firstValue * secondValue ^ ; swift_lint.swift:8:5: error: type annotation missing in pattern let product Int = firstValue * secondValue ^ swift_lint.swift:8:17: error: cannot assign to immutable expression of type 'Int.Type' let product Int = firstValue * secondValue ~~~ ^

ok now it's fine.. thanks