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 trialKyudong Lim
528 PointsHelp. Im very close to finishing this and I can't seem to figure it out.
Here is the prompt : Finally, using console.printf print out a formatted string that says "Because you said <response>, you passed the test!"
2 Answers
Grigorij Schleifer
10,365 PointsHi there:)
Try this:
String response;
do{ response = console.readLine("Do you understand do while loops?");
}while(response.equalsIgnoreCase("no"));
console.printf("Because you said %s, you passed the test!", response);
Sean Keegan
6,255 PointsSo..
You already have the code which prompts the user for a response until they say something other than "no".
Once this do while loop has finished, the code will continue. You should write some code after that congratulates the user and tells them the response they gave, which will have the same syntax as this:
console.printf("Congrats, you said %s and therefore you passed!", response);
Modify that to make it appropriate for the test and put it in the correct place, then you should be on your way!
String response
do {
response = console.readLine("Do you understand do while loops?");
} while(response.equalsIgnoreCase("no"));
//Enter you line of code here
Kyudong Lim
528 PointsKyudong Lim
528 Pointsand here's my code. String response; do{ response = console.readLine("Do you understand do while loops?");
}while(response.equalsIgnoreCase("no"));