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

Some help

How do I go about this

types.swift
// Enter your code below
let firstValue = 23
let secondValue = 32
let product = (23*32)

2 Answers

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Gerald,

The question tells you:

Declare a constant named product and assign the result of multiplying firstValue and secondValue together.

You have multiplied two number literals together (23 and 32) and haven't used firstValue or secondValue.

Cheers

Alex

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

hmmm ... I was asked to answer this question.

As Alex has pointed out, you shouldn't perform the multiplication on the two raw numerical values, replace 'em w/ the two constants instead. On top of that, it's unnecessary to put the parenthesis () around them. Parenthesis is used in the case when you need to change the operator precedence in the calculation. e.g. (3+2) * (5+2), in this case, the parenthesis is necessary because you want to force the addition to be performed before the multiplication, otherwise just leave the parenthesis out when it's not needed. In Swift, parenthesis happens to be also a language construct for creating a data structure, putting the extra parenthesis in the code that doesn't need to be there would only create visual noise for the reader of the code.

Also, Part 2 of the challenge has TWO steps, don't forget to complete the step 2 of creating a string literal to pass the challenge.

happy coding.