samedi 11 janvier 2020

Executing next else statement after some counting

If x <2, than we execute some code, else if x>2 repeats more than 5 times then we execute another code. What is proper structure for this task?

int counter =0;
int=x;
if (x<2)
       doSomething;
else 
      count++
else if (count>5)
      doSomethingElse;

Aucun commentaire:

Enregistrer un commentaire