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 2.0 Basics Swift Types Recap: Swift Types

Nick Madafiglio
Nick Madafiglio
181 Points

How do you create a string literal that describes the operation?

I have no idea what to do I have tried everything I can. I feel the code so have I have is right. It could be completely wrong tho. I'm trying everything I can and I feel like I'm getting nowhere. Any help would be appreciated.

types.swift
// Enter your code below
let firstValue = 10
let secondValue = 20

let product =  firstValue * secondValue 

let someString = 

let output = 

1 Answer

Nathan Tallack
Nathan Tallack
22,160 Points

You were almost there.

A string literal just means you are creating the string. So when you are saying something like:

let myName = "John"

The let is saying create a constant, the name is saying to name the constant myName, the = is saying assign what follows to what precedes, and the "John" is the string literal. That means it is a string that you are literally defining.

So your code would look like this following the second task in the challenge.

let firstValue = 10
let secondValue = 20

let product =  firstValue * secondValue 

let output = "The product of \(firstValue) times \(secondValue) is \(product)."
Nick Madafiglio
Nick Madafiglio
181 Points

Thanks so much Nathan. I'm really new at this and I got close just not quite there. Thanks again for the help. Your explanation really helped.