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

Philipp Hahn
Philipp Hahn
1,366 Points

Stuck in the steps, int contants and strings.

It seems that I need help in almost every chapter, but Its already a big task for me to understand everything in english. I need a little help for this task, seems I slow in understanding but I dont give up.

types.swift
// Enter your code below
let firstValue = 2014
let secondValue: Int = 20
let product = firstValue * secondValue

6 Answers

Hi Philipp,

You're doing fine! Just remove the Int which you don't need. As long as you assign an integer on the right of the equals sign, you're fine. So, let secondValue = 20, for example. The whole number 20 is the integer so there's no need to specify the data type with : Int.

The rest is correct; just the string interpolation part to do now.

Let me know how you get on.

Steve.

Hi Philipp,

Your output needs to be a longer string using all three constants such that it looks like, "The product of \(firstValue) times \(secondValue) is \(product)".

You need to assign that string to a constant called output.

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

Make sense?

Steve.

Philipp Hahn
Philipp Hahn
1,366 Points

thank you steve,

let firstValue = 10
let secondValue = 20
let product = firstValue * secondValue
let interpolatedOutput = "\(product)"

something seems to be missing, I think the constant of output seems incorrect

Philipp Hahn
Philipp Hahn
1,366 Points

I am trying to get it,

let firstValue = 10
let secondValue = 20
let product = firstValue * secondValue
let output = "\(firstValue) * \(secondValue) = \(product)"

its a challenge for me, but still I get the "bummer" note ^^

The output constant needs to contain the words "The product of 10 times 20 is 200". You interpolate the three constants in between those words. So, your output is correct but uses shorthand of * instead of times and = instead of equals. The string is:

"The product of \(firstValue) times \(secondValue) is \(product)"
Philipp Hahn
Philipp Hahn
1,366 Points

I got it! Thank you, also thank you for beeing patient with me ^^

No problem - glad you got through it! :+1: :smile:

Please give Steve a "Best Answer". It gives Steve a bonus 12+ forum points for the question's topic (in this case Swift). It also places a green check mark next to this question in the Community :)

Thank you for understanding. ~Alex

Philipp Hahn
Philipp Hahn
1,366 Points

alright, thanks for the advice