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 trial

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)") '''