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

Devin Goodson
Devin Goodson
907 Points

What am I doing wrong. I can't find the answer on here or docs.swift

let firstValue = 2 let secondValue = 4

let product = "firstProduct * secondProduct"

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

types.swift
// Enter your code below

let firstValue = 2
let secondValue = 4 

let product = "firstProduct * secondProduct"


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

1 Answer

Hi Devin,

You don't want to surround the product calculation (right side of the equals) in quotes. They are constant names, not strings.

Also, the constructed string uses the values held in the constants. So, for example:

let name = "Steve"

let output = " My name is \(name)"

You've added the values as hard-coded numbers. You just want to interpolate the values contained within firstValue, secondValue and output into the string you have created correctly.

Make sense?

Steve.