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

do while loop

I just need a next step, if someone could help me out. I'm not sure where to start. Please don't give me an answer. Just tell me if I'm on the right track and give me a hint.

Example.java
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
boolean isNo;
do {
    response = console.readLine("Do you understand do while loops?"  );
    isNo = (response.equalsIgnoreCase("no"));

}

2 Answers

sergio alvarez
sergio alvarez
15,205 Points

No to provide you the answer but you have to remember that a while loop has to have a condition, you are missing the condition, as an example

do {code} while (condition);

Gabriel Plackey
Gabriel Plackey
11,064 Points

You're very close, the response code is right. isNo is incorrect. You are missing the while part all together. You're telling it to do this. Then you need to tell it do that while this is true or equal to no.