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 trial
Hassan Osman
628 Pointsreponse=console.readLine("do you understand do while loop") while (reponse.equalsIgnoreCase("no));
why its not working
3 Answers
Ryan Ruscett
23,309 PointsBased on the snippet you provided. It's to hard to tell exactly. A do while loop is
Do (ask me if I understand loops) while (some condition is true)
In this instance it's an input from the user.
So you want to do something like this in pseudocode/real code lol.
Do reponse = console.readLine("do you understand do while loop") while (reponse.equalsIgnoreCase("no));
So ask me if I understand Python. And if I say no. Then it's going to ask me again and again and again. But if I say yes, then well, the while is false and the loop will exit.
Does that help you understand it better?
Ryan Ruscett
23,309 Pointsif this is your code
reponse=console.readLine("do you understand do while loop") while (reponse.equalsIgnoreCase("no));
You tell me. Did you pass the challenge? That code is not wrapped in a do while loop. So no it's not correct as is.
Hassan Osman
628 Pointsso what is the code
Hassan Osman
628 PointsHassan Osman
628 Pointsyes so is my code correct