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 trialJohn Anselmo
Courses Plus Student 2,281 PointsDo-while loop help
Can't you just call promptForGuess() whenever you have an error instead of doing a do while loop? That's what I did and it worked perfectly, however, I do think it is less work to just do the do-while loop right?
Daan Visker
782 PointsDo you mean in the Hangman.java code, or in the Prompter.java? I would expect that you might be repeating yourself at some place, or you might get in trouble with asking for a new entry and running through your maximum amount of tries. Without your example-code it is hard to say if it works the same or not.
However, as Craig has often remarked, there might be many different ways to accomplish the same goal!
Kristopher Goodwin
632 PointsKristopher Goodwin
632 PointsI'm not a 100% on what your code looks like, but are you able to still print out the exception messages in the loop format?