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

Juan Bosco
Juan Bosco
5,843 Points

Hi, what is it im doing wrong? ;(

let firstValue = 2000 let secondValue = 3000

let product = "(firstValue) * (secondValue)"

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

types.swift
let firstValue = 2
let secondValue = 3

let product = "\(firstValue) * \(secondValue)"

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

2 Answers

First, the product constant needs to just store the product of the two Integers, and as such shouldn't store a string. Second, you seem to have used both string interpolation as well as concatenation in attempt to create the output constant that needs to store a string that will print "The product of 2 times 3 is 6". Instead what you have done is created a string that would output "The product of (firstValue) times (secondValue) is (product)".

let firstValue = 2
let secondValue = 3

let product = firstValue * secondValue

let output = "The product of \(firstValue) times \(secondValue) is \(product)"
Juan Bosco
Juan Bosco
5,843 Points

Dear Kyle,

Fantastic response. Very impressed of the quick reply from both of you! Thanks!

No need to put firstValue and secondValue in string interpolation when multiplying.

Juan Bosco
Juan Bosco
5,843 Points

Dear Nehemiah,

Thank you for the fast reply man!