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 trialGabriel E
8,916 PointsTotally clueless on task 2 of 3 for perfecting prototypes.
Hi there,
I am supposed to continually prompt the user on the question "do you understand do while loops", as long as they say no. I am totally stuck on how to continually prompt them using do while loops. Could you give me some help please? Thanks!
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
boolean isInvalidWord;
do {
response = console.readLine("Do you understand do while loops?");
isInvalidWord = (response.equalIgnoreCase("no"));
while(isInvalidWord) }
1 Answer
Kristian Terziev
28,449 PointsThere is no need to initialize a new variable called isInvalidWord. Just use the equalsIgnoreCase mathod on the response variable like so:
String response;
do {
response = console.readLine("Do you understand do while loops?");
} while (response.equalsIgnoreCase("no"));
coder5837
1,535 Pointscoder5837
1,535 PointsI think that you forgot the period in between equal and ignorecase!