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

Ricardo Gonzalez
Ricardo Gonzalez
2,286 Points

What does it mean when it is asking to make a String Literal?

Need clarification on what the challenge is asking me to do.

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

A string literal is simply a fancy way of saying a sequence of characters in between quotation marks. name = "Jennifer".... the string literal would be "Jennifer". So here's my solution and I'll walk you through it.

let firstValue = 9
let secondValue = 3
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"
  1. Make a constant named firstValue and assign an integer.
  2. Do the same thing for another one named secondValue
  3. Make another constant named product and assign the product of the first two variables to it.
  4. Use string interpolation to assign a formatted string which displays the values of those variables inside it.

Hope this clears things up! Happy coding!

Ricardo Gonzalez
Ricardo Gonzalez
2,286 Points

I see now what I did wrong. The wording confused me a bit. Thanks for clarifying for me.