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
Steven Parker229,018 Points
You're quite right that this job can be done with only one "if", and good eye for spotting it!
But the purpose of the lecture is to show how boolean variables can be used, and the code shown gives a clear example. As a "best practice" developer, you'll employ your skills to create code that's both clear and efficient, but in the courses you can expect the teachers to occasionally forgo efficiency when illustrating a particular principle.
Hi , quite new to programming ( my first programming ever doing this course) could you provide an example of how you would reduce this to a single if statement?