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 trialKenneth Low
430 PointsI solved the challenge in a different way than they asked, and while it is different the outcome is the same.
let height = 120.0 // in inches let width = 144.0 // in inches
let area = height * width
let areaInFeet = area / 12
// 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
1 Answer
Mac Bellingrath
13,502 PointsYou're right, the output was effectively the same. It is "swift" in nature to be as concise as possible. If you can perform both operations in one line of code rather than to establish an additional variable, your code will be more readable. In more complex cases, however, you might write a helper method that could handle complex operations and simple call them when needed. Happy Swifting!
Kenneth Low
430 PointsKenneth Low
430 PointsThanks! It's just frustrating that this is literally the way the video taught, and the challenge is asking for something else.
Mac Bellingrath
13,502 PointsMac Bellingrath
13,502 PointsIt can be frustrating. Think about it like this, running into challenges like this is how you'll become a better developer! The best developers don't just follow instructions, they are capable of solving problems. You can do it.