- Aswin Barath
Jump statements can be used to modify the behaviour of conditional and iterative statements.
continue statements fall under the jump statements category.
breakstatement, borrowed from C programming language, breaks out of the current loop when encountered.
- So, any further iterations will not be executed as the
breakstatement changed the flow of the program by coming out of the loop.
Searching... Searching... Searching... Searching... Found the treasure
continuestatement, borrowed from C programming language, continues with the next iteration of the loop when encountered.
- So, any code following the
continuestatement in a loop will be skipped and the loop will continue the next iteration.
Found an even number 2 Found an odd number 3 Found an even number 4 Found an odd number 5 Found an even number 6 Found an odd number 7 Found an even number 8 Found an odd number 9