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

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