Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics Swift Types Recap: Swift Types

Eric villalobos
Eric villalobos
938 Points

this is still not the correct code, after i am convinced it is correct it is not. i need the exact code

https://teamtreehouse.com/library/swift-3-basics/swift-types/recap-swift-types what is the exact code for this task? i am convinced my code is correct, and can not find the error in my code.

types.swift
// Enter your code below 
let firstValue: Int = 2001
let secondValue: Int = 2002
let product = "firstValue * secondValue"
let output = "The product of \(firstValue) times \(secondValue) = \(product)"
Jason Anders
Jason Anders
Treehouse Moderator 145,538 Points

Hi Eric villalobos

I have deleted the previous, duplicate threads you posted with this question. Please refrain from multiple postings for the same question in the Community.

Thank you.
Jason ~Community Moderator

4 Answers

let product = "firstValue * secondValue" // This is a string!

// It needs to be...

let product = firstValue * secondValue
andren
andren
28,503 Points

In addition to the problem that aidenmitchell has pointed out you also have an issue in your last line of code with regard to the task instructions. Namely that your string does not match the structure of the example string the instructions provide to the letter.

The example string is "The product of 2 times 4 is 8" notice the use of "is" rather than an equal sign which is what you are using in your string.

The complete answer to this challenge looks like this:

// Task 1
let firstValue: Int = 2002
let secondValue: Int = 2003

// Task 2
let product = firstValue * secondValue
let output = "The product of \(firstValue) times \(secondValue) is \(product)"

Also please try to not create so many duplicate posts, especially without checking if the previous post has already been answered. This is in fact the second time I have posted this code for you, as I already left an answer on your previous post.

Jason Anders
Jason Anders
Treehouse Moderator 145,538 Points

Hi andren

I moved your response to the Answers (for up-voting). I also deleted the duplicate threads for this question, unfortunately, this also included the first response you provided. Apologies. :)

Thank you for all your participation in the Community. :thumbsup:

~Jason :dizzy:

andren
andren
28,503 Points

Don't worry about that, my first response was nothing ground breaking anyway :smile:.

I originally posted my response as a comment due to the fact that I was mostly just repeating the answer I already provided in the other thread, so it felt strange to leave it as an answer again. With that thread deleted it makes sense to have it as an answer.

And thank you for your active role in moderating this forum :+1:. I always appreciated the cleanup and assistance you provide.

Eric villalobos
Eric villalobos
938 Points

my apologies i was missing something on my end

I'm having a problem with the code challenge. im putting in everything right but it won't take my code. help please!!