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

Farnoosh Johnson
Farnoosh Johnson
7,887 Points

swift types

I dont know what else I can do for this question

I also tried the line 4 as this: let product: Int = firstValue * secondValue

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) "
Luis Villarreal
Luis Villarreal
10,040 Points

Your answer is correct. Just that the challenge terminal is very picky. Remove the ": Int" and you will be fine.

let firstValue = 2

let secondValue = 4

let product = firstValue * secondValue

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

1 Answer

Martin Wildfeuer
PLUS
Martin Wildfeuer
Courses Plus Student 11,071 Points

Your code is correct, but the output string contains leading and trailing spaces. Code check is (and has to be) picky there, make sure to follow the exact format mentioned in the assignment. That is, remove the spaces :)

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

P.S.

Type annotations ( In your case : Int ) should not affect code checks, unless they are wrong.