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 trialHerbert Keijman
702 Points"Make sure you are looping while the value stored in response is equal to No" Why is the value not equal to no?
What am I doing wrong here? In the do block I stated answerIsNo is no when response is no. Why and how do I store the value in response as No?
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
boolean answerIsNo;
do {
response = console.readLine("Do you understand do while loops");
answerIsNo = (response.equals("no"));
}
while(answerIsNo);
1 Answer
Sam Baines
4,315 PointsHerbert - maybe your answer "No" has to be case sensitive - so either the string from the user input needs to be converted to all lowercase so that it equals "no" or you need to change the value in the response.equals("No") to No with a capital N. I'm not sure as I havent done the challenge myself.
Herbert Keijman
702 PointsHerbert Keijman
702 PointsYes, it was case sensitive, but I never thought I had the right code. I completed it now, thanks a lot!