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

Daniel Walsh
Daniel Walsh
309 Points

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

The title is what they asked me todo, I am not sure what I am doing wrong probably doing it wrong. Any help would be appreciated!

area.swift
// the height and width of a wall
let height = 120.0 // in inches
let width = 144.0 // in inches
let areaInFeet = Double(area) / 10.764

2 Answers

John Simoneau
John Simoneau
9,326 Points

Hey Daniel, you're so close! I did the same thing you're doing... the 10.764 is to convert to meters (that was in the example they gave). Here for the task, we just need to calculate the area... regular width * height. Hope this helps!

Daniel Walsh
Daniel Walsh
309 Points

That did it! I had to divide it by 12 on top of that so it ended up looking like this "let areaInFeet = height\12 * width\12".