0
why use continue ?
int x=10; while(x>5){ system.out.println("hello") if(x==30){ continue; } x++; }
2 Antworten
0
continue is used to restart the loop from the beginning. say you take input and want to check if it is an integer
while {
input=get input;
if(input != int){
print: "Choose only int!";
continue;
} else {
print: "Good Job";
break;
}
}
If the input isn't an int, it would instruct user to enter an int and restart the loop asking for input again.
0
thx ❤