R repeat loop
A repeat loop is used to iterate a block of code. It is a special type of loop in which there is no condition to exit from the loop. For exiting, we include a break statement with a user-defined condition. This property of the loop makes it different from the other loops.
A repeat loop constructs with the help of the repeat keyword in R. It is very easy to construct an infinite loop in R.
The basic syntax of the repeat loop is as follows:
Example 3: Infinity repeat loop
Example 4: repeat loop with next