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 trialgaetan mertens
1,002 Pointsdo while doesnt work
This code doesn't loop correctly I don't get why
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
do response = console.readLine("Do you understand do while loops? ");
while(response.equals("no"));
1 Answer
Katie Wood
19,141 PointsHi there,
A lot of your actual code is correct, but there are a couple things missing from the do-while loop syntax. The framework for that looks like this:
do {
//code goes here
} while(); //condition goes here
You can keep most of your current code - just need to add the curly braces in the right places. Also, when I did the challenge it was picky about the value I checked for - you may need to capitalize "No".
Hope this helps!