function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shoesmanshoesman 

ERROR: Loop control must be contained by a Loop

hi,

 

Ive got this erroe but I have no idea why I got this, 

 

the apex class is 

 

----------------------

Integer R = math.mod(ran1,ran2);     

Integer d = (ran1/ran2);

public Integer getDivideNumber() {
      if (R!=0) {   
          continue;  
          }else{
      return d;
      break;
   }

}

----------------------

 

Whant I am trying is that I dont want to have remainder, I would like to have only the answer by dividing.

But it seems its looping,  do some have any idea to solve this issue ????

 

 :mansad::smileysad:

 

shoesmanshoesman

PS:

 

I am seriously need to solve this !! 

 

Please someone help me !!

VarunCVarunC
You may want to show the code of class here ..
XactiumBenXactiumBen

The commands you have - 'continue;' and 'break;' - are only used when in a loop.  Not exactly sure what you're trying to achieve.  Do you just want to return the value d if there is no remainder? If so try just returning null if R is not equal to zero.