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

Christian Kroul
Christian Kroul
9,849 Points

Swift Recap

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

types.swift
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = firstValue * secondValue
let output = " The product of \(firstValue) times \(secondValue) is \(product)"

3 Answers

Richard Lu
Richard Lu
20,185 Points

Hey Christian,

I see a space at the beginning of your output constant which is the root of the problem you're receiving. Omit that and you should be all set.

// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = firstValue * secondValue
let output = /* there was a space at the beginning of this constant (inside the string literal) */ "The product of \(firstValue) times \(secondValue) is \(product)"

Good luck!

EDIT: 10.26.15

The challenge has been fixed, and you can now have your solution look like this with the types:

// Enter your code below
let firstValue: Int = 10
let secondValue: Int = 5
let product: Int = firstValue * secondValue
let output: String = "The product of \(firstValue) times \(secondValue) is \(product)"
Christian Kroul
Christian Kroul
9,849 Points

Well, that space really did make a difference Thanks Richard

Christian Kroul
Christian Kroul
9,849 Points

Oh wow thank you, it was because of that space.

Can somebody please explain the last part to me.
let output: String = "The product of (firstValue) times (secondValue) is (product)" why do we put "the product of and times" in the string I don't remember them going over this in the video please help I'm lost