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 trialSarah Hermansen
251 PointsCompiler error
I'm a little confused -- could someone help me point out the error?
String response;
do {
response = console.readLine("Do you understand while loops?");
if (response.equalsIsIgnoreCase("no")) {
}
} while(noun.equalsIgnoreCase("no")) {
}
// I keep getting a compiler error, please help!!!
1 Answer
joelearner
54,915 PointsHi Sarah!
It looks like things just got a little jumbled. Not a problem! This is not too bad to fix.
One thing is to eliminate many of the curly braces. The only curly braces you need here are for the "do" part of the loop. You will not need them for the "while" part of the loop.
Also, the beginning of an if statement found its way in but this challenge does not need a conditional. The do while loop will pass the requirement just fine.
Then we'll keep the while condition simple and just require the response to be "No" (like the way it is written in the question).
When you're finished, your code should look something like this:
String response;
do {
response = console.readLine("Do you understand do while loops?");
} while (response == "No");
Cheers!