I want my program to keep asking the question until it gets a response it can use, specifically a number from 0 to 20. I have a lot of other stuff on this class, so here is a small excerpt where the do-while is (I have named the variables and all that for everything).
public static void main(String[] args) {
do {
halp = 1;
System.out.println("What level is your fort?");
Scanner sc = new Scanner(System.in);
try {
fortLevel = Integer.parseInt(sc.nextLine());
}
catch(NumberFormatException e){System.out.println("Numbers only, 0-20"); halp = 0;
}
if(halp < 1) {
work = false;
}
if(halp > 1) {
work = true;
}
while(work = false);
}