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

Java Java Objects Delivering the MVP Exceptions

Brendan Passey
Brendan Passey
999 Points

At this point do we need promptForGuess to return a boolean?

I was going through my code and realised that at this point returning the boolean isHit from promptForGuess doesn't do anything. I imagine we needed it in the past before we set it up to call the applyGuessMethod.

I've made it a void method and taken out the return line and it seems to work fine, am I missing something?

Could you post your code here?

1 Answer

Steven Parker
Steven Parker
231,271 Points

You're right, since the return value is being ignored it make no difference if the function has a return or not. Disregarding the return is perfectly safe, though, so converting the function is purely optional.