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.

leo 001
2,357 Pointswhy promptForGuess has to return a boolean value?
why promptForGuess has to return a boolean value?
2 Answers

Craig Dennis
Treehouse TeacherWe use this to check and see if the guess was a hit or not. This allows the prompting code to handle the different cases.
Make more sense?

leo 001
2,357 PointsThanks for replying. When we use it in the play() method, we just call it, but it does not return the boolean to anything, is that ok? should it be return void for this case?
public void play(){ while(mGame.getRemainingTries()>0 && !mGame.isSolved()){ displayProgress(); promptForGuess(); }
Florian Janosch
871 PointsFlorian Janosch
871 PointsI have the same problem as leo 001... Why would we want to return the isHit in the last line of promptForGuess???