iOS Swift Basics Swift Types Recap: Swift Types

Step 2 Help

Need help with Step 2 of this problem. Confused on creating string interpolation, how to write the code out, and understanding what goes where and why.

types.swift
// Enter your code below

let firstValue = 2

let secondValue = 4

let product = firstValue * secondValue

2 Answers

Alex Koumparos
MOD
Alex Koumparos
Python Web Development Treehouse Moderator 33,477 Points

Hi Timothy,

Pasan demonstrates string interpolation at around 10:37 in the strings video.

Which part of his explanation are you struggling with? The clearer you can be about what you don't understand the easier it will be to give you useful guidance.

Cheers

Alex

The part I don’t understand is how to write it out in string interpolation

Alex Koumparos
MOD
Alex Koumparos
Python Web Development Treehouse Moderator 33,477 Points

How to write what out in string interpolation? Are you able to see and hear the video correctly? When he types:

let interpolatedAddress = "\(country), \(state), \(city)"

are you able to see that on your screen? Are you able to make the same code work on your computer? If not, that is one problem. If you are able to see his code and recreate it on your computer, is the problem that you don't understand what string interpolation is? Or is that you don't understand how the syntax works for string interpolation in Swift? Or is it that you don't understand what the challenge wants the output to look like? Each of these has a different answer, so we need to get a more specific explanation of what is causing you difficulties. Your question doesn't make it clear which of the above problems you are having, so it is currently impossible to help you.

The problem i am having is how to write it out in String Interpolation like how to word it and what symbols i need to use.