It's not entirely clear why one would use while when an if should suffice. The only reason the variable wouldn't set like that is perhaps tied variables, or solar flares.
Maybe it would work with either a) different values, or b) a different variable. You'd have to test some more to find out.