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

aj picard
aj picard
1,258 Points

Wouldn't the answer be: let output = "The product of 7 times 13 is 91" ?

Confused what you guys are asking me to do.

types.swift
// Enter your code below

let firstValue = 7
let secondValue = 13
let product = firstValue * secondValue 
let output = "The product of 7 times 13 is 91"

2 Answers

Chuck Underwood
Chuck Underwood
22,751 Points

The answer is looking for String Interpolation. You have output built with just a String.

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

Do you want to have to change the value of firstValue in both places or do you want to make the code work for you?

harshil bhatt
PLUS
harshil bhatt
Courses Plus Student 2,722 Points

no your answer is correct but the program wants you to get the value of first value, second , and the product the program thinks that output has only string no int which you dont want to give try this

let firstValue = 7 let secondValue = 13 let product = firstValue * secondValue let output = "The product of (firstValue) times (secondValue) is (product)" // this way it knows you are asking the value of the given constant