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 trialChuck Chiemelu
Courses Plus Student 330 PointsHow to properly setup this logic and create an output similar to a Calculator
I am bit confused by the instructions.
// Enter your code below
let firstValue = (15)
let secondValue = (35)
let product = "firstValue * secondValue"
let output = "\(firstValue) * \(secondValue) \(is product)"
2 Answers
jonlunsford
15,480 PointsYou need to create two integer variables. Get their product, then output a string such as "Number 1 x Number 2 = answer". Make sure to declare your variables properly.
let value1: Int = 10
let value2: Int = 20
let product: Int = value1 * value2
let output: String = "\(value1) x \(value2) = \(product)"
kjvswift93
13,515 PointsThe product constant stores an integer value, not a string.
let firstValue = 4
let secondValue = 5
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)."