Break & Continue
There are many scenarios in programming when you have to exit or restart a loop based upon a certain condition or scenario.
SRON provides 'break' and 'continue' keyword to control and manipulate the control flow of loops. Both of these keywords can only be used inside the scope of 'for', 'foreach' or 'while' attribute.
'break' keyword is used to shift the control flow of program outside the scope of loop. Let's take a look on usage of 'break' keyword. Below is a sample code:
OUTPUT :
1 2 3 4 Breaking the loop Outside the Loop!
Now, let's see how 'continue' keyword. It is used to shift the control flow of program to the starting of the loop. See the below sample code for it:
OUTPUT :
continuing loop 11 12 13 14 continuing loop 16 17 18 19 Outside the Loop!
Last updated