in Technology by

When should you apply “next” statement in R? When is it appropriate to use the “next” statement in R?

Please log in or register to answer this question.

1 Answer

0 votes

A data scientist will use next to skip an iteration in a loop. As an example:

> val1 <- 1:30
> for(val in val1){
+ if(val == 25){
+ next
+ }
+ print(val<span style="border:0px; color:#777777; font-family:inherit; font-size:1.1em; font-stretch:inherit; font-style:inherit; font-variant:inherit; font-weight:inherit; line-height:inherit; margin:0px; padding:0px; vertical-align:baseline" class="enlighter

Related questions