samedi 28 mars 2020

how does a break function in the inner loop in R?

while (statement 1){
  ......
  ......
  if (statement 2){
    x <- x + 1
    break
  }
  if (statement 3){
    y <- y + 1
  }
}

I have a pseudocode as shown above, I want to verify my understanding whether is correct or not. Is it when the statement 2 is fulfilled, the equation in the 1st if loop will still run, then it will break the if loopand never come back again even the while loop still continue going on?

I hope I can get an explanation about the break function in this senario. Appreciate for your help!

Aucun commentaire:

Enregistrer un commentaire