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 trialleo 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???