Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ranvir Sahota
9,844 PointsWhy declare wasDispensed?
Could we have not achieved the same results with this code? public boolean dispense() { if (!isEmpty()) { pezCount--; return true; } return false; }

Ranvir Sahota
9,844 PointsThanks AJ Longstreet I wasn't taking readabilty into account. If you put your answer into a post ill give it best answer and upvote
1 Answer

AJ Longstreet
Treehouse Project ReviewerYou could achieve the same result, but it would not be as readable. It's very important for your code to be easy to read and follow.
Whether you are working on a team or simply returning to your own code after a period of time. If the code is not easy to follow, it will not be easy to build upon or improve.
AJ Longstreet
Treehouse Project ReviewerAJ Longstreet
Treehouse Project ReviewerYou could achieve the same result, but it would not be as readable. It's very important for your code to be easy to read and follow.
Whether you are working on a team or simply returning to your own code after a period of time. If the code is not easy to follow, it will not be easy to build upon or improve.