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

Samuel Bryson
PLUS
Samuel Bryson
Courses Plus Student 461 Points

Stuck on Step 2

stuck on step 2

types.swift
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 4
let product: Int = 8

let output: String = "firstValue + secondValue + product"

1 Answer

I can see what you're stuck with and have written the correct code out for you below.

To give an explanation as to where you were going wrong is by answering the product yourself rather than writing the code to make it calculate it itself. If firstValue and secondValue were a lot higher numbers, you'd want the code to give you the answer rather than hard code it yourself. As for the string interpolation, it can take to getting used to at first so have a look at what i've done below, by dropping in the values within a Stringed sentence. It created the sentence that the question asks for. I hope this helped.

''' let firstValue: Int = 2 let secondValue: Int = 4 let product = firstValue * secondValue

let output = ("The product of ( firstValue) times (secondValue) is (product)") '''