just want to break out of this while loop. Condition doesn't break when I assumed it will, but it does get registered by the subsequent if statement.
String current_Class_Name = "";
int current_Class_Rating;
while(!current_Class_Name.equals("Done")) {
// * Get class name.
System.out.println("What class are you rating?");
current_Class_Name = in.nextLine();
// *
// if(current_Class_Name.equals("Done")) {
// System.out.println("Detected 'Done'");
// break;
// }
// * Get class rating.
System.out.println("How many plus signs does " + current_Class_Name + " get?");
current_Class_Rating = Integer.parseInt(in.nextLine());
// * If user inputs an invalid rating (not a value between 0-5),
// * keep prompting them until they enter a valid input.
while(current_Class_Rating > 5 || current_Class_Rating < 0) {
System.out.println("Sorry, but you can only give a rating of 0-5.");
System.out.println("How many plus signs does " + current_Class_Name + " get?");
current_Class_Rating = Integer.parseInt(in.nextLine());
}
// * TODO
// * Add to STRING and INTEGER LISTS.
}
Possibly some kind of call order problem as the String is "empty" upon entering the while loop. Sorry for any formatting.
Thanks for any and all help.
NOTE : I typically use C# and as far as I remember, a while loop will try and detect the condition case before completing an entire iteration.
EDIT : The if statement is not there to run, but to just prove two things : 1) that the break condition can be detected and 2) to break out at a given time.
EDIT : Updated to show all code in consideration.