R – Next Statement
Next statement in R is used to skip any remaining statements in the loop and continue the execution of the program. In other words, it is a statement that skips the current iteration without loop termination.
‘next’ is a loop control statement just like the break statement. But ‘next’ statement works opposite to that of break statement, instead of terminating the loop, it forces to execute the next iteration of the loop.
Next Statement in R Programming Language Syntax
Next Statement in R Programming Flowchart
Next Statement in R Language Example
Example 1: Using next in the for loop
 6  7  9  10  11
The next statement can be used with any other loop also like ‘while’ or ‘repeat’ loop in a similar way as it is used with for loop above.
Example 2: Using next in the while loop
 11  10  9
Example 3: Using next in the repeat loop
 0  1  2  3  4
My Personal Notes arrow_drop_up
Please Login to comment...