Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics Swift Types Recap: Swift Types

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.