关于为什么break
在这里不起作用的任何想法?我需要让它工作,否则它会永远循环。
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.
}
}
答案 0 :(得分:2)
我会改变:
if (count = inputNumber)
到
if (count == inputNumber)