Tim Tim -4 years ago 152
R Question

do-while loop in R

I was wondering about how to write do-while-style loop?

I found this post:

you can use repeat{} and check conditions whereever using if() and
exit the loop with the "break" control word.

I am not sure what it exactly means. Can someone please elaborate if you understand it and/or if you have a different solution?

Answer Source

Pretty self explanatory.


Or something like that I would think. To get the effect of the do while loop, simply check for your condition at the end of the group of statements.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download