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"
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
harshil bhatt
Pro 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