lundi 27 juillet 2020

How to skip the if statement inside the loop

I'm struggling on how my code could stop pass by the "if statement" when rate reach some desired value. Here is some kind of pseudo algorithm (if the code is not clear I can try to change, since it is very clear to me, that is too 'inside' the problem).

for(i in 1:500){
  if(i %% 100 == 0){
    cte = cte * A #value of A differs according the `rate` value 
  }
  A = function(A)
  rate = function(A, cte)  
}

If rate reach certain value, e.g, if 0.15 < rate < 0.3, I'd like to never come back to the if statement. Even if the rate goes out of that range along the 'for loop', I don't go back to the 'if'.

Any hint on how can I do that?

Aucun commentaire:

Enregistrer un commentaire