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

John Moron
John Moron
1,658 Points

How to Give the height and width of a wall in inches, calculate the area in feet and assign it to a constant.

Please help I'm trying to assign a constent but I says I'm doing it wrong

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

2 Answers

You're not assigning the let area to anything. It's supposed to look like this:

import UIKit

let height = 120.0

let width = 144.0

let area = height * width

John Moron
John Moron
1,658 Points

yes I know I wasn't assigning the let to anything, I left it blank on purpose but thank you for helping me btw.

Oh, so you're trying to convert the inches into feet? You just divide the inches by 12 to get the feet

// the height and width of a wall

let height = 120.0 / 12

let width = 144.0 / 12

let area = height * width

let areaInFeet = area