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

No clue how to approach a bug... :(

My code is as follows

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

let product: Int = firstValue * secondValue

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

I have no idea what goes wrong, so that I don't know where or what to fix... :(

types.swift
// Enter your code below

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

let product: Int = firstValue * secondValue

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

2 Answers

Richard Lu
Richard Lu
20,185 Points

Hi Klaus,

I gave this answer to another student that had the same question. The code you have is definitely correct, but I think what the instructor wants to emphasize is type inferencing (allowing the compiler to figure out the types). Here's what he wants:

// Enter your code below
let firstValue = 5
let secondValue = 7
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"  

Happy coding!

hi Richard, that seemed to be the problem. thank you very much.

Pasan Premaratne
STAFF
Pasan Premaratne
Treehouse Teacher

Klaus,

That answer should definitely work! I found the bug in our challenge and fixed it.

perfect. thx!