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

I DO NOT UNDERSTAND WHAT DO WRONG! Can some help me?

i would like to get help with this

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

let area = height * width

let areaInFeet = Area / 12

5 Answers

L B
L B
28,323 Points

Firstly, you have capital A when calling area which is wrong. But thats not the main problem. You are trying to do the following:

(120 * 144) / 12 = 1440 : This is wrong

(120 / 12) * (144 / 12) = 120 : This is correct

So the answer is:

let areaInFeet = (height / 12) * (width / 12)
Martin Wildfeuer
PLUS
Martin Wildfeuer
Courses Plus Student 11,071 Points
let areaInFeet = Area / 12

First of all, you have written area with a capital a, therefore it is an undefined variable which throws an error. Changing this will make your code compile, however, you need to tweak the calculation:

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.

Hope that helps :)

thanks a lot

thanks a lot

I really appreciate the fast reply!

thanks Guys