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

mark hengstebeck
mark hengstebeck
1,119 Points

With this task on Xcode, the error I am receiving is "an unterminated string literal". I do not understand.

let firstValue = 2 let secondValue = 3 let product = 2 * 3 let output = 6 let interpolatedOutput = "(firstValue) * (secondValue) = (product)”

types.swift
// Enter your code below
let firstValue: Int = 2
let secondValue: Int = 3

2 Answers

Ollie King
Ollie King
10,194 Points

Hi Mark,

You are very close. It looks like you have missed the \ (backslash) from the code when interpolating strings. Your code should look like this:

// Enter your code below

let firstValue = 2 let secondValue = 3 let product = firstValue * secondValue

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

Hope this helps? :)

Ollie King
Ollie King
10,194 Points

Ok it's not showing the backslashes, but before every set of parenthesis () in the code put in a backslash.

mark hengstebeck
mark hengstebeck
1,119 Points

Thanks Ollie, That's it. My code should look like this: // Enter your code below let firstValue = 2 let secondValue = 3 let product = firstValue * secondValue let output = "The product of (firstValue) times (secondValue) is (product)" Thanks, Mark