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 trialAran Taylor
173 Pointstypes.swift
This looks right, but it's telling me that I'm wrong, even though the preview tells me there is nothing wrong with it. Help please?
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = "firstValue * secondValue"
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
4 Answers
Tobias Helmrich
31,602 PointsHey there,
good job, you almost got it right! The problem is that you're setting the product constant to the String "firstValue * secondValue". To multiply the values you have to remove the quotes around the calculation like so:
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
I hope that helps! :)
Ahmet GULER
7,181 Pointsyou are putting let product constant value inside quotes " ". so product constant is becoming a String.
Ahmet GULER
7,181 Pointslet product = firstValue * secondValue
this way it will stay as an Integer
Aran Taylor
173 PointsThanks both so much :) Really new to Swift so feel kinda stupid that I made such a simple mistake. Thanks for your quick and helpful replies though :)
Tobias Helmrich
31,602 PointsI'm glad I could help! But you shouldn't feel stupid now, simple mistakes happen to all of us. Keep up the good work! :)
Aran Taylor
173 PointsThanks very much :D