+ 5
Understanding "continue;"
I am not able to understand what is the function of continue , how to use it , and the difference between continue and break. For Other People Who Are Also Confused Check The Code Pasted Below:- https://code.sololearn.com/c3Rnm9QPRgPn/?ref=app
8 Antworten
+ 16
//here is an application of using continue
for example u want to print even numbers from 1 to 10
for (int a=1;a <=10;a++){
if (a%2==1) continue;
else System.out.println (a);
}
+ 11
If "continue" encounters then the statement after "continue" skips for that iteration but loop cannot stop. But if "break" encounters then loop stops.
+ 8
Break leaves the loop completely and executes the statements after the loop. Whereas Continue leaves the current iteration and executes with the next value in the loop. ... A continue statement is used to end the current loop iteration and return control to the loop statement.
+ 6
when x=30 then its doesnt print or say ignore to print...
+ 4
don't say thank you.help to another three people and tell them help other three people,small help do big impact ☺
+ 2
thank you
+ 2
Ok :)
+ 2
@Gaurav Agarwal I used your code and it prints out odd numbers instead of even numbers.
https://code.sololearn.com/c3Rnm9QPRgPn/?ref=app