b=10;
while(a=b) {
b--;
if(b==-10)break;
}
B goes from 10 to -10.
In my world, the while-statement, a=b, should always be true (since the assigment always “goes well”). That is not the case.
When the loop stops, b will have a value of 0.
In my world, it should pass 0 and go all the way to -10, when the if-statement kicks in.
Have I misunderstood something major?
(Code tested in IE8 and Adobe Acrobat)
The value of an assignment is the value being assigned, so you can chain assignments
a = b = 2for example, so whenb=0, the value ofa=bis 0.