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

Wahid Fayad
Wahid Fayad
330 Points

Figuring out the Operators challenge task

Hi,

I don't understand this challenge task question.

it has: Given the height and width of a wall in inches, calculate the area in feet and assign it to a constant named areaInFeet.

Okay here is the pre written code: // the height and width of a wall let height = 120.0 // in inches let width = 144.0 // in inches

I think I should write: let areaInFeet = height / 12 ... but I dont know what to write next . it doesnt explain what other constant names i should name it.. and if i just tap check work. I get error message:

Bummer! Your 'areaInFeet' constant has the wrong value. Divide height by 12 to get the height in feet. Do the same with the width. Then multiply the height in feet by the width in feet.

2 Answers

Jeremy Hayden
Jeremy Hayden
1,740 Points

Wahid,

You are super close. for area you need to multiply height by width. or

let areaInFeet = height * width

But then it wants it in feet, not inches. So you have to divide both height and width by 12 like below.

let areaInFeet = height/12 * width/12
Wahid Fayad
Wahid Fayad
330 Points

Thanks for the help!