-1

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. 
      }
   }
Oliver W.
  • 13,169
  • 3
  • 37
  • 50

1 Answers1

2

I would change:

if (count = inputNumber)

to

if (count == inputNumber)
MaxZoom
  • 7,619
  • 5
  • 28
  • 44
  • hi this was the solution, you are correct, i realised within 2 seconds of posting where i had gone wrong. Had i not realised though your answer would have been a massive help :D many thanks – Joseph Howarth Jan 18 '15 at 23:24
  • 1
    Great, a plus would be appreciated. – MaxZoom Jan 18 '15 at 23:26