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 trialDevin Goodson
907 PointsWhat 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"
// 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
Steve Hunter
57,712 PointsHi 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.