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

Open 1 Answers 64 Views Technology

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

1 Answer

0

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
by (277k points)
...