Count break not working

109 Views Asked by At

Any ideas as to why the break is not working here? I need to get it to work otherwise it just loops forever.

  int count = 0;           
  while (inputNumber != 0 )
  {
      int x = this.light.getDiameter();
      this.light.setDiameter(inputDiameter);
      changeColour();
      this.delay(100);
      this.light.setDiameter(x);
      changeColour();
      {
         count++;
      }
      if (count = inputNumber)
      {
         break;    // HERE: it was never reached. 
      }
   }
1

There are 1 best solutions below

2
MaxZoom On

I would change:

if (count = inputNumber)

to

if (count == inputNumber)