« Return to Thread: breaking a loop in R

breaking a loop in R

by kayj :: Rate this Message:

Reply to Author | View in Thread

Hi All,

I was wondering if there is anything that breaks a loop in R. For example,


For (k in 1:100)
For ( i in 1:10){

If ( condition ){
Break the inner loop
}

}
}

In the above case, if the program runs the if statement, then I want the inner loop for (i in 1:10) to stop looping and skip the rest of the program.

Thanks for your help

 « Return to Thread: breaking a loop in R