Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in R Programming by (5.3k points)

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

you can use repeat{} and check conditions wherever 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?

1 Answer

0 votes
by
edited by

You can use the following function to implement a do-while style loop:

repeat{ 

statements... 

if(condition){ 

break 

}

Also,

repeat( { expressions}; if (! end_cond_expr ) {break} )

If you want to explore more in R programming then watch this R programming tutorial for beginners:

Related questions

0 votes
1 answer
asked Sep 23, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 8, 2019 in Python by Sammy (47.6k points)

Browse Categories

...