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 trialmark ng
Python Web Development Techdegree Student 2,649 PointsCoding issue
Now continually prompt the user in a do while loop. The loop should continue running as long as the response is No. Don't forget to declare response outside of the do while loop. Anyone please help to rectify whats wrong with my coding. Thankyou.
JavaTester.java:129: error: cannot find symbol } while( response.equalsIgnoreCase); ^ symbol: variable equalsIgnoreCase location: variable response of type String JavaTester.java:129: error: illegal start of type } while( response.equalsIgnoreCase); ^ 2 errors
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
do {
response = console.readLine (" Do u understand do while loops ? ") ;
if ( response.equalsIgnoreCase("no"));
console.printf ( "Do u unserstand do while loops ? \n " );
} while( response.equalsIgnoreCase);
3 Answers
Simon Coates
28,694 Pointstry
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
do {
response = console.readLine (" Do u understand do while loops ? ") ;
} while( response.equalsIgnoreCase("no"));
Your syntax errors are because equalsIgnoreCase is a method (requires brackets), expecting a value to be passed in.
gregory gordon
Full Stack JavaScript Techdegree Student 14,652 Pointsdoesnt the %s have to be conected to somthing in this code what is it connected to?
Simon Coates
28,694 Pointscomplete answer is:
String response;
do {
response = console.readLine (" Do u understand do while loops ? ") ;
} while( response.equalsIgnoreCase("no"));
console.printf("Because you said %s, you passed the test!", response);
But Mark seems stuck on the second part of the challenge, so i didn't submit an answer for the third.