In conditions=> '1' is always considered as TRUE and '0' as False.
So,
while(1)
{
}
Means the condition is true and it will loop forever as '1' is a constant value and is TRUE. The 'if' condition in your code could only break it out of the while loop. Similarly all assignments and all expression that evaluate to >0 are considered TRUE
Ex: while(3*12){}, while(a=b){}, while(9/3){}
These would loop forever unless there is a condition inside the loop that breaks the loop.
Similarly, all expressions that evaluate to '0' or FALSE never enter the loop.
Ex: while(a=0){}, while(0){}, while(5-5){} ,etc