Can't this be done by negating `x` outside the loop?