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 Basics Perfecting the Prototype Looping until the value passes

Godfrey Adiges
Godfrey Adiges
2,146 Points

Read the comments and code below. We want to move that prompting code into a do while loop. Wrap the code into a do whil

This exercise is fairly difficult how would I complete it?

1 Answer

Hey Godfrey!

The basic structure for a do while loop in Java is as follows:

do {
    //Put the code in here that you want to execute.
} while(i < 5); //This is where your condition goes.

Using the structure I have provided above try your best to complete the code challenge. If, after a few attempts, you are still having difficulties feel free to post back here and I shall further assist you!

Have fun programming.

-Luke

Godfrey Adiges
Godfrey Adiges
2,146 Points

I've tried many times but still having difficulty

Okay, please could you post the information about the challenge and I shall walk through it with you and help you as best as I can.

Thanks!

-Luke

Godfrey Adiges
Godfrey Adiges
2,146 Points

I just figured it out now. Thanks for your help

Awesome I am glad you managed to figure it out! Please mark a best answer in this thread so other forum users know that your problem has been solved!