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 (retired) Operators Binary Operators

CAN SOMEBODY HELP ME PLEASE??

I TRIED VERY HARD, BUT I STILL DONT GET IT, PLEASE HELP.

rdaniels
rdaniels
27,258 Points
// the height and width of a wall
let height = 120.0 // in inches
let width = 144.0 // in inches
let areaInFeet = (120.0/12) * (144.0/12)

This worked for me. the trick is dividing both values by 12 before multiplying. You have to change "inches" into "feet". Hope this helps!

1 Answer

The best way to answer this challenge is to use the declared constant names 'width' and 'height' passed into the new constant, as opposed to using the numbers they are initially assigned to. Granted, they are declared as constants so the numbers won't change, but this is best practice.

// the height and width of a wall
let height = 120.0 // in inches
let width = 144.0 // in inches

let areaInFeet = (height / 12) * (width / 12)