"Closures in Swift" was retired on May 31, 2020.

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

Java Java Basics Perfecting the Prototype Looping until the value passes

Apurv Jayakumar
Apurv Jayakumar
587 Points

This is for question 2/3 on the last Challenge of the Java Basics Course. Please tell me what is wrong with my code.

// I have initialized a java.io.Console for you. It is in a variable named console.

String response = console.readLine("Do you understand do while loops?");

do (response.readLine("No")) {

console.printf("Do you understand do while loops?"); }

while (response.readLine("No")) { console.prinf("Noice m8"); }

1 Answer

you don't need statement inside of parentheses in the do while loop should look like this:

do {
    //run code here and will always run at least once
} while (some condition here)

also when using console.readLine() put the question in the parentheses not the response